使用Javascript / jQuery的/ CSS。如何在目标div之外维护拖动事件?
I am implementing a scrollbar using jQuery/Javascript/CSS. The usual. Everything is going according to plan except for the following use case:
我正在使用jQuery / Javascript / CSS实现滚动条。通常。除了以下用例之外,一切都按计划进行:
The user mouses down in the scrollbar div hosting mousedown/mousemove/mouseup event handlers. The user initiates a drag gesture - mousemove starts firing - that soon moves the cursor outside the bounds of the scrollbar div and onto the surrounding div real estate on the web page. The moment this happens, mousemove - as expected - stops firing events.
用户将鼠标停留在托管mousedown / mousemove / mouseup事件处理程序的滚动条div中。用户启动拖动手势 - mousemove开始触发 - 很快将光标移动到滚动条div的边界之外,并移动到网页上的周围div房地产上。一旦发生这种情况,mousemove-正如预期的那样 - 停止触发事件。
How do I continue to have mousemove fire events without resorting to just attaching a mousemove handler to the root div? How do I maintain scrollbar dragger translation even though the cursor has wandered off the scrollbar?
如何在不诉诸于将mousemove处理程序附加到根div的情况下继续使用mousemove fire事件?即使光标从滚动条上移开,如何保持滚动条拖动器转换?
Thanks,
Doug
1 个解决方案
#1
0
Instead of using onmousemove on the element, use it on the document.
而不是在元素上使用onmousemove,在文档上使用它。
更多相关文章
- Github推送事件签名不匹配
- 在鼠标悬停事件中使用Javascript隐藏内容
- 谷歌Chrome复制了JavaScript的“焦点”事件
- js“DOM事件”之鼠标事件、js的测试方法、js代码的放置位置
- 使用angularjs添加包含事件的新标记
- jqGrid 数据加载完事件 loadComplete 使用
- JavaScript - 检测click事件是否触发了DOMNodeInserted事件
- Jquery中动态添加元素的绑定事件不起作用
- 我可以使用onBlur事件对TextBox进行日期检查吗?