Created
July 6, 2017 09:58
-
-
Save ABooooo/17d1d356abe462bcf1720ea4e8c1f9e6 to your computer and use it in GitHub Desktop.
Change CSS on scroll
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 scroll_pos = 0; | |
$(document).scroll(function() { | |
scroll_pos = $(this).scrollTop(); | |
if(scroll_pos > 210) { | |
$(".navbar-default").css({"background-color": "black" , "padding-top" : 0}); | |
} else { | |
$(".navbar-default").css({"background-color" : "transparent" , "padding-top" : "30px"}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment