如何在IE11中禁用平滑滚动 [英] How to disable smooth scrolling in IE11

查看:384
本文介绍了如何在IE11中禁用平滑滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE的平滑滚动导致我的应用程序行为异常(滚动事件会稍微延迟触发)。

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

有没有办法在IE11中完全禁用平滑滚动CSS或Javascript?

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

推荐答案

为IE11的所有Windows 8用户启用IE的平滑滚动功能。

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

您可以通过转到Internet选项,高级并取消选中使用平滑滚动来禁用它。它解决了这个问题。但是,您网站的所有用户都不会这样做。所以我强烈建议你不要禁用它。尝试在用户将使用的相同计算机/浏览器上进行开发。否则,您的网站用户就会出现不一致之处。我也建议不要更改默认浏览器设置,原因相同。

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.

这是一个JS修复程序。

Here is a JS fix.

小提琴

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);
    });
}

这篇关于如何在IE11中禁用平滑滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆