javascript and dragging in firefox

不问归期 提交于 2019-12-24 23:23:29

问题


I am writing a script to scroll a div container with javascript. Unfortunately it is not working that well in firefox. In firefox the stop-icon appears next to the cursor once I start dragging the knob and then my script is not able to get the mouseup-event.

Does anyone have an idea how to fix this?

http://www.novuspix.de/scroll/


回答1:


Check that mousemove event attached to document or window and not to the .knob element.




回答2:


For those looking for a fix to a stop icon blocking the mouseup event (as I was when I found this post) I asked the question too, and finally found the answer myself which is here : **SOLVED** Click and drag on links in Firefox are blocking mouseup events

here is the JS code, everything is more detail on the question

const links = document.querySelectorAll('a');
links.forEach(element => {element.addEventListener('mousedown',function(e) { 
  e.preventDefault();
})
})


来源:https://stackoverflow.com/questions/10320505/javascript-and-dragging-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!