Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runScroll() {
- scrollTo(document.querySelector("#store-menu-component"), 0, 600);
- }
- var scrollme;
- scrollme = document.querySelector("#next");
- scrollme.addEventListener("click",runScroll,false)
- function scrollTo(element, to, duration) {
- if (duration <= 0)
- {
- return;
- }
- var difference = to - element.scrollTop;
- var perTick = difference / duration * 10;
- setTimeout(function() {
- element.scrollTop = element.scrollTop + perTick;
- if (element.scrollTop == to)
- {
- return;
- }
- scrollTo(element, to, duration - 10);
- }, 10);
- }
Add Comment
Please, Sign In to add comment