问题
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