JQuery滚动并收集中间元素的值

发布于 2024-11-18 21:36:19 字数 438 浏览 4 评论 0原文

我已经设置了 2 个小提琴。其中一个工作正常。它应该计算出屏幕上可见的中间值。

第一个小提琴在滚动上表现得令人钦佩。

第二个包含一个触摸框架,该框架在滚动时不起作用,但在滚动后按下测试按钮时起作用。这适用于 Google Chrome 和 Safari,但请尝试在 Firefox 上使用。您将看到它不会生成正确的值并停留在底部。

任何解决此问题的想法。

奇妙

I have set up 2 Fiddles. One is working perfectly. It is supposed to work out the middle value visible on screen.

The first fiddle performs this admirably on scroll.

The second incorporates a touch framework that does not work on scroll, but does work when you press the test button after scroll. This works on Google Chrome and Safari, but try it on Firefox. You will see it will not generate the correct value and stick at the bottom.

Any ideas how to fix this.

Marvellous

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2024-11-25 21:36:19

尝试更改

$('#leftwheel').scroll(...);

$('#leftwheel').mousemove(...);

这不会非常高效,但对于非触摸设备来说可以正常工作。 查看更新的 Fiddle

如果您想在触摸设备上使用它,mousemove可能不会火。

Try changing

$('#leftwheel').scroll(...);

to

$('#leftwheel').mousemove(...);

This won't be super-efficient, but will work OK for non-touch devices. See updated Fiddle

If you are looking to use this on touch devices, mousemove likely will not fire.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文