Created
July 29, 2013 18:56
-
-
Save AleeRojas/6106736 to your computer and use it in GitHub Desktop.
Leave menu bar fixed on top when scrolled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Dynamic top menu positioning | |
* | |
*/ | |
var num = 300; //number of pixels before modifying styles | |
$(window).bind('scroll', function () { | |
if ($(window).scrollTop() > num) { | |
$('.navbar').addClass('navbar-fixed-top'); | |
} else { | |
$('.navbar').removeClass('navbar-fixed-top'); | |
} | |
}); | |
//http://jsfiddle.net/adamb/F4BmP/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment