Skip to content

Instantly share code, notes, and snippets.

@petrchutny
Last active July 28, 2017 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrchutny/cbd4f5357d5bb2ae06908856089c1415 to your computer and use it in GitHub Desktop.
Save petrchutny/cbd4f5357d5bb2ae06908856089c1415 to your computer and use it in GitHub Desktop.
Menu button changing colour on scroll (jQuery)
// Menu button changing colour on scroll
if($(".header").hasClass("white")) {
var button = $('button.mobile-menu path')
$(window).scroll(function(){
var scrollPos = $(window).scrollTop(),
headerHeight = $('.hero-background').height();
if(scrollPos > headerHeight) {
button.css({fill : "#000000"});
} else {
button.css({fill : "#FFFFFF"});
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment