0

I have a smooth scrolling script that scrolls you down to a section when you click a link. The script has worked in Firefox on multiple computers but has only worked on Chrome on one computer.

link.linkName.onclick = function() {
    clearInterval(scroll);
    var viewport = window.innerHeight;
    var scroll = setInterval(function() {
        document.documentElement.scrollTop += 25;
        if (document.documentElement.scrollTop >= viewport * 3) {
            clearInterval(scroll);
            document.documentElement.scrollTop = viewport * 3;
        }
    }, 10);
};
Drown
  • 5,852
  • 1
  • 30
  • 49
Zygomorph
  • 11
  • 2

0 Answers0