terrymun / Fluidbox

Replicating and improving the lightbox module seen on Medium with fluid transitions.
http://terrymun.github.io/Fluidbox/
Other
2.15k stars 166 forks source link

Prevent closing fluidbox in closestart event #204

Open babobski opened 4 years ago

babobski commented 4 years ago

I'm currently implemented fluidbox in a new web project, I'm combining it with a jquery zoom plugin. It works great only when I zoom out of the image, fluidbox closes because the drag for the zoom is a click event for fluidbox.

I was hoping I could do a event.preventDefault in the closestart.fluidbox event, but this is not working.

terrymun commented 4 years ago

This feels like an XY problem: the closestart event is fired because closing has already been initiated: so conceptually it is already too late to stop closing at this point.

Instead, you might want to prevent the click event from propagating from the jQuery zoom plugin instead. In that sense, the click event does not bubble up to the fluidbox DOM and therefore will not be caught and trigger closing.