光标卡在 IE 中
在我的拖放实现中,我在整个页面上创建一个“mask”元素,并向其应用 mousemove
事件,以及根据需要的 CSS cursor
属性和相关的。当被拖动的元素被放下时,遮罩元素就会被删除。这工作得很好,但是在 IE 中光标会暂时卡住。它保持在掩码设置的任何位置,但在完成任何操作后恢复正常(单击任意位置,按键盘上的任意键,但不仅仅是移动鼠标)。这不是一个主要问题,但它可能会令人困惑 - 特别是在被拖动的元素很小的情况下,因此我将光标设置为 none
以便更容易地看到正在拖动的内容完毕。
有什么建议吗?
编辑:我制作了一个测试页面,它工作得很好,所以这可能是因为页面非常复杂。有趣的是,光标不仅卡在文档中,它还卡在窗口的其他地方 - 例如,我必须将其松开才能更改选项卡或在 URL 栏中输入内容。看起来 JavaScript 正在影响整个程序,这看起来更像是 IE bug,而不是 JavaScript 错误......
In my drag-and-drop implementation, I create a "mask" element over the whole page and apply a mousemove
event to it, along with a CSS cursor
property as needed and relevant. The mask element is then removed when the element being dragged is dropped. This works perfectly fine, however in IE the cursor gets temporarily stuck. It stays at whatever the mask had it set to, but reverts to normal when anything is done (clicking anywhere, pressing any key on the keyboard, but NOT just moving the mouse). This isn't a major problem, but it can be confusing - especially in the case where the element being dragged is small so I set the cursor to none
in order to make it easier to see what is being done.
Any suggestions?
Edit: I made a test page and it's working just fine, so it's probably because of how complex the page is. Interestingly, the cursor doesn't just get stuck in the document, it gets stuck elsewhere on the window too - I have to unstick it to be able to change tabs or type in the URL bar, for example. It seems like the JavaScript is affecting the entire program, which seems more like an IE bug than a JavaScript error...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我做了什么,但现在已经解决了。可能需要做一些小事情,比如使蒙版可滚动(如果蒙版的内容比页面大)就可以了。
I'm not sure what I did, but it's fixed now. Possibly something small like making the mask scrollable (in case the mask's content is bigger than the page) is all it took.