隐藏溢出时检测用户滚动尝试 [英] Detect user scroll attempt when overflow is hidden

查看:55
本文介绍了隐藏溢出时检测用户滚动尝试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当内容 overflow:hidden 时,scroll不会触发。 wheel轮式鼠标发生火灾但魔术触控板魔术鼠标。如何在这种情况下检测尝试滚动的鼠标交互?

解决方案

您可以获取鼠标坐标和其他属性,如移动



使用该位置,您可以选择何时触发滚轮事件或只是让脚本滚动页面。



<请检查此小提琴(不是我的)以获得灵感


"scroll" does not fire when content is overflow: hidden. "wheel" fires for wheel mouses but not on a magic trackpad or magic mouse. How can I detect the mouse interaction of attempting to scroll in this scenario?

解决方案

You can get the mouse coordinates and other properties like movement easily.

Using that position you can choose when trigger an wheel event or just make the script to scroll the page.

check this fiddle (not mine) to get inspired

这篇关于隐藏溢出时检测用户滚动尝试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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