CharisKomos (Talk | contribs) |
CharisKomos (Talk | contribs) |
||
Line 50: | Line 50: | ||
scrollTillBottom(); | scrollTillBottom(); | ||
} | } | ||
+ | </script> | ||
+ | |||
+ | <!-- Smooth Scrolling (Top to Bottom and vice versa) --> | ||
+ | <script> | ||
+ | var myVar; | ||
+ | function scrollTillBottom() { | ||
+ | var i=0; | ||
+ | myVar = setInterval(function(){ i += 1; scrollBy(0,10); console.log(i); if(i == 150) myStopFunction(); }, 2); | ||
+ | } | ||
+ | |||
+ | function scrollTillTop(){ | ||
+ | var j=0; | ||
+ | myVar = setInterval(function(){ j += 1; scrollBy(0,-10); console.log(j); if(j == 150) myStopFunction(); }, 2); | ||
+ | } | ||
+ | |||
+ | function myStopFunction() { | ||
+ | clearInterval(myVar); | ||
+ | } | ||
+ | |||
+ | $('#toTop').click( function(e) { | ||
+ | e.preventDefault(); | ||
+ | scrollTillTop(); | ||
+ | }); | ||
</script> | </script> | ||
Revision as of 20:31, 28 August 2017