Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1203201
    bambooinn
    Participant

    hello,

    I was wondering with the Integrity theme, whether a nav bar can be behave like this site:

    http://www.communityfibre.bt.com/resources/

    By scrolling down, the nav bar disappears with the top. By scrolling upwards it appears (regardless how far down you are on the page).

    Thanks

    #1203262
    Thai
    Moderator

    Hi There,

    To achieve that, please add the following Javascript under Customizer > Custom > Global Javascript:

    jQuery( function($) {
    	var didScroll;
    	var lastScrollTop = 0;
    	var delta = 5;
    	var navbarHeight = $('.x-navbar').outerHeight();
    
    	$(window).scroll(function(event){
    	    didScroll = true;
    	});
    
    	setInterval(function() {
    	    if (didScroll) {
    	        hasScrolled();
    	        didScroll = false;
    	    }
    	}, 250);
    
    	function hasScrolled() {
    	    var st = $(this).scrollTop();
    	    
    	    // Make sure they scroll more than delta
    	    if(Math.abs(lastScrollTop - st) <= delta)
    	        return;
    	    
    	    // If they scrolled down and are past the navbar, add class .nav-up.
    	    // This is necessary so you never see what is "behind" the navbar.
    	    if (st > lastScrollTop && st > navbarHeight){
    	        // Scroll Down
    	        $('.x-navbar').removeClass('nav-down').addClass('nav-up');
    	    } else {
    	        // Scroll Up
    	        if(st + $(window).height() < $(document).height()) {
    	            $('.x-navbar').removeClass('nav-up').addClass('nav-down');
    	        }
    	    }
    
    	    if (st == 0) {$('.x-navbar').removeClass('nav-down')};
    	    
    	    lastScrollTop = st;
    	}
    });

    After that add the following CSS under Customizer > Custom > Global CSS:

    .x-navbar {
        transition: all 0.5s ease;
    }
    .x-navbar.nav-up {
        margin-top: -51px;
    }

    Replace the 51px with your navbar height 🙂

    Hope it helps 🙂

    #1203279
    bambooinn
    Participant

    hahaha.. amazing. Thanks!

    working.

    #1203296
    bambooinn
    Participant

    Hey!

    I have a rev slider above the masterhead.. it seems to be off now (the navbar is either too high or too low when opened).

    Can you help?

    http://dev.bamboo-inn.nl

    #1203349
    Paul R
    Moderator

    Hi,

    Try to select full screen layout for your slider then add .masthead as offset.

    See screenshot – http://screencast.com/t/UUujVjptygo

    Hope that helps.

    #1203506
    bambooinn
    Participant

    Hi Paul,

    Good job! Thanks….worked!

    #1203521
    Joao
    Moderator

    Glad to hear it,

    Joao

  • <script> jQuery(function($){ $("#no-reply-1203201 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>