Created
July 2, 2019 06:31
-
-
Save ArtemSites/f2694e618a2d013be4a88a67e4d329c7 to your computer and use it in GitHub Desktop.
Фиксация верхнего меню при прокручивании вниз.
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
var windowScroll = null; | |
var headerMenuNodePosition = headerMenuNode.offset().top; | |
var headerMenuNode = $('.js-header-menu'); | |
$(window).on('scroll load', function () { | |
windowScroll = $(window).scrollTop(); | |
if (windowScroll > headerMenuNodePosition) { | |
headerMenuNode.addClass(fixedClass); | |
} else { | |
headerMenuNode.removeClass(fixedClass); | |
} | |
}); | |
// console.log(windowScroll); | |
// console.log(headerMenuNodePosition); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment