Method for only disabling the click listener's preventDefault()
See original GitHub issueThank you for #123.
But having the new option affect all events goes a little far for my use case. Now if I set preventMouseEventsDefault: false
, I scroll the screen when trying to pan via touch or zoom with the mousewheel.
Is there a way to prevent this?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >Method for only disabling the click listener's preventDefault()
I've set preventMouseEventsDefault: false for my click listener to work. Now if you try to zoom using the mousewheel, the page obviously scrolls ......
Read more >How to unbind a listener that is calling event.preventDefault ...
In my case: $('#some_link').click(function(event){ event.preventDefault(); });. $('#some_link').unbind('click'); worked as the only method ...
Read more >event.preventDefault() | jQuery API Documentation
preventDefault(). This method does not accept any arguments. For example, clicked anchors will not take the browser to a new URL. We can...
Read more >How to correctly use preventDefault(), stopPropagation(), or ...
Now we see that not only does the click event not bubble up the DOM, but by removing the preventDefault method call the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Agreed. Having preventDefault enabled on clicks causes problems with some SVG child elements (for example, hyperlinks in elements will not respond to clicks), and disabling it doesn’t really cause any issues since there aren’t any default behaviors for single-clicking an SVG. However, disabling preventDefault causes problems with drag-to-pan, especially on mobile browsers.
I worked around the issue by editing the code so that mousemove/touchmove are always subject to preventDefault.
Basically, yes. If you prevent everything, panning on mobile and zooming with the mousewheel don’t work anymore.