Sitemap

Agrimalin

Be smart, think of PUBLIC TRANSPORT !

All the advices
$(function() { var lastScrollTop = 0; var sticky = $(".agrimalin-sticky"); //Listen scroll event $(window).scroll(function() { //Detect if sticky is on top var scroll = $(window).scrollTop(); if (scroll >= 1) { sticky.addClass("cloak"); } else { sticky.removeClass("cloak"); } //Detect if user scroll up or down var scrollPosition = $(this).scrollTop(); if (scrollPosition > lastScrollTop){ sticky.addClass("cloak"); } else { sticky.removeClass("cloak"); } lastScrollTop = scrollPosition; }); //Show/hide sticky on hover sticky.mouseenter(function(){ $(this).removeClass('cloak') }).mouseleave(function(){ $(this).addClass('cloak') }); });