移动中的滚动事件触发延迟 [英] Scroll event fire delay in mobile

查看:346
本文介绍了移动中的滚动事件触发延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有滚动事件监听器,并且在桌面浏览器(滚动开始时-事件立即触发)和移动设备上的chrome浏览器(chrome最新版本+ android 5.0)和所有其他移动浏览器(ff ,Android浏览器)的工作方式有所不同,在进行了一些谷歌搜索之后,我发现了原因:这是因为直到滚动动作完全停止(将手指从屏幕上松开)后才触发滚动事件.

I got event listener to the scroll and everything works fine with desktop browsers(when scrolling starts - the event fired straight away) and chrome browser in mobile(chrome latest version + android version 5.0), but with other mobile browsers(ff, android browser) this works differently, and after googling for some I found the reason: it's because the scroll event is not fired until the scrolling action comes to a complete stop(releasing the finger from the screen).

我的问题是对此有一些解决方法,也许是一些最佳实践,因此它可以正常启动(对于台式机而言),而不会显着改变性能?

My question is there some workaround for this, perhaps some best practice, so it will fire normally(as for desktop) and without dramatically performance changes?

*仅适用于JS解决方案(不适用于jquery).

*JS solution only(no for jquery).

推荐答案

您可以使用 iScroll .它不依赖jQuery,并且可以实现所需的功能(在移动平台上连续触发滚动事件).

You can use iScroll. It does not depend on jQuery and achieves what you want ( firing scroll events on mobile platforms ~continuously ) among other things.

您可以参考此答案以了解如何使用iScroll来实现.

You can refer to this answer for how to implement this using iScroll.

这篇关于移动中的滚动事件触发延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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