Last active
August 29, 2015 14:26
-
-
Save overwine/d5cf59ab2a907b9cebde to your computer and use it in GitHub Desktop.
Revisions
-
overwine revised this gist
Aug 6, 2015 . 1 changed file with 21 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,23 @@ var lastScrollTop; //console.log(lastScrollTop); $(window).scroll(function(event){ $('.top-filter').stop(); var currentScrollTop = $(window).scrollTop(); if (currentScrollTop > lastScrollTop){ $('.top-filter').animate({ top: "-20px", }, 1000); console.log("Scroll down!"); //$('body').addClass('has-scrolled') } else { $('.top-filter').animate({ top: "147px", }, 1000); console.log("Scroll up!"); //$('body').removeClass('has-scrolled') } console.log(lastScrollTop); console.log(currentScrollTop); lastScrollTop = currentScrollTop; }); -
overwine created this gist
Aug 6, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ var lastScrollTop = 0; console.log(lastScrollTop); $(window).scroll(function(event){ var currentScrollTop = $(window).scrollTop(); if (currentScrollTop > lastScrollTop){ $('.top-filter').animate({ top: "-20px", }, 1000); //$('body').addClass('has-scrolled') console.log(currentScrollTop); } else if (currentScrollTop <= lastScrollTop) { $('.top-filter').animate({ top: "147px", }, 1000); //$('body').removeClass('has-scrolled') } lastScrollTop = currentScrollTop; console.log(currentScrollTop) });