Created
September 20, 2016 10:07
-
-
Save amici-fos/05ca4760821121341b97c5d85daa2ba9 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
if ($( ".subtabs" )){ | |
$( window ).scroll(function() { | |
var p = $( ".subtabs" ); | |
var offset = p.offset(); | |
var viewableOffset = p.offset().top - $(window).scrollTop(); | |
console.log($(window).scrollTop()); | |
if(viewableOffset<=20){ | |
p.addClass("fixed"); | |
} | |
if ($(window).scrollTop()<60){ | |
p.removeClass("fixed"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment