Skip to content

Instantly share code, notes, and snippets.

@zdimaz
Created September 4, 2018 12:12
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 zdimaz/0965e983e3db5d196fd8c2937901a397 to your computer and use it in GitHub Desktop.
Save zdimaz/0965e983e3db5d196fd8c2937901a397 to your computer and use it in GitHub Desktop.
Sticky block
// sticky
function asideSticky() {
// body...
var asideItem = $('.aside_navigation'),
asideItemOffset = asideItem.offset().top;
$(window).scroll(function(){
if( $(this).scrollTop() > asideItemOffset ){
asideItem.addClass('sticky');
}
else {
asideItem.removeClass('sticky');
}
});
}
asideSticky();
// sticky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment