Last active
September 9, 2016 07:45
-
-
Save oscarotero/3c3ec20267098f06c67b7a5966ee364d to your computer and use it in GitHub Desktop.
Scripts comúns
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
/* Cabeceira "sticky" */ | |
var sticked = false; | |
var $window = $(window); | |
var $html = $('html'); | |
$window.on('scroll', function() { | |
var pos = $window.scrollTop(); | |
if (pos > 5 && !sticked) { | |
$html.addClass('is-scrolled'); | |
sticked = true; | |
} else if (pos < 5 && sticked) { | |
$html.removeClass('is-scrolled'); | |
sticked = false; | |
} | |
}).trigger('scroll'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment