Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable smooth scrolling in IE11

IE's smooth scrolling is causing my app behave strange (scroll events are fired with a small delay).

Is there a way to completely disable smooth scrolling in IE11 using CSS or Javascript?

like image 306
Tzach Avatar asked Apr 02 '15 15:04

Tzach


1 Answers

IE's smooth scrolling feature is turned on for all windows 8 users of IE11.

You can disable it by going to Internet options, Advanced, and uncheck use smooth scrolling. And it resolves the problem. But all users of your site will not do that. So I highly recommend you not disabling it. Try to develop on the same machines/browsers that your users will use. Otherwise you will have inconsistencies with your users of your site. I also recommend to NEVER change the default browser settings, for the same reason.

Here is a JS fix.

Fiddle

if(navigator.userAgent.match(/Trident\/7\./)) {
    $('body').on("mousewheel", function (event) {
        event.preventDefault();
        var wd = event.wheelDelta;
        var csp = window.pageYOffset;
        window.scrollTo(0, csp - wd);
    });
}
like image 98
M H Avatar answered Oct 18 '22 09:10

M H