CharisKomos (Talk | contribs) |
CharisKomos (Talk | contribs) |
||
Line 44: | Line 44: | ||
function displayMe(idz){ | function displayMe(idz){ | ||
$('#display_box').css('display', 'block'); | $('#display_box').css('display', 'block'); | ||
+ | scrollTillBottom(); | ||
} | } | ||
+ | </script> | ||
+ | <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> | ||
</head> | </head> |
Revision as of 02:07, 18 August 2017