Created
May 25, 2016 22:41
-
-
Save wpstudio/e357c1fc346346e74b4cfb2b0e860e31 to your computer and use it in GitHub Desktop.
This file contains 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
jQuery(document).ready(function(){ | |
var $window = jQuery(window), | |
$mainMenuBar = jQuery('#nav-module'), | |
$mainMenuAnchor = jQuery('#anchor-stick'); | |
$window.scroll(function(){ | |
var window_top = $window.scrollTop(); | |
var div_top = $mainMenuAnchor.offset().top; | |
if (window_top > div_top){ | |
$mainMenuBar.addClass('sticky'); | |
} else { | |
$mainMenuBar.removeClass('sticky'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment