worka / vanilla-js-wheel-zoom

Image resizing using mouse wheel (pinch to zoom) + drag scrollable image (as well as any HTML content)
https://worka.github.io/vanilla-js-wheel-zoom
MIT License
168 stars 31 forks source link

excludeClass - allow elements to be clickable #41

Open laraduarte opened 1 year ago

laraduarte commented 1 year ago

Can you implement something similar to this feature available in panzoom

"Add class options.excludeClass (default is "panzoom-exclude") to whatever element you want to be clickable. Panzoom will check for this class before handling the event. Alternatively, add a reference to the element to the exclude option, or call event.stopImmediatePropagation() in an event handler on the clickable element."

worka commented 1 year ago

You can always access the desired element from outside the plugin and perform any action, or use an event.stopImmediatePropagation() as written in your quote. Does this option work for you?

agletd commented 1 year ago

event.stopImmediatePropagation() is not helping

worka commented 1 year ago

Most likely because you are listening to the click event, you need to interrupt the mousedown event handler