0

I currently have a website that autoscrolls a user to a certain section when they hit a certain point on the page. To do this, I had to disable the user's scrolling while the autoscroll is taking place in order to prevent them from disrupting the autoscroll. After updating to Safari 9, I can no longer disable the user's scrolling until they stop manually scrolling. So they can currently scroll past the autoscroll anchorpoint, and my disableScroll function doesn't take effect until they stop scrolling. How can I disable the user's scrolling while they're in mid scroll? Here's the code I'm using to disable scrolling. Again, this was working fine before Safari 9. Should I should use the new scroll snapping that was recently implemented in Safari 9 instead?

disableScrolling = function() {
    window.onwheel = preventDefault; // modern standard
    window.onscroll = preventDefault;
    window.onmousewheel = document.onmousewheel = preventDefault; 
}


preventDefaultTest = function(e) {
    e = e || window.event;
        if (e.preventDefault) {
            e.preventDefault();
        }
    e.returnValue = false;
}
user3709990
  • 111
  • 7
  • for what it's worth, a lot of people consider "scrolljacking" to be a pretty odious practice. if there were an extension to block it i'd use it. – seagull Dec 17 '15 at 12:49
  • Scrolljacking should be banned. I wish there was a browser setting to block this annoying feature. – Steve Kuo Feb 27 '16 at 23:45

0 Answers0