-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If original image has a transition, zoom becomes uncloseable #110
Comments
@francoischalifour I am fairly certain this is a bug, not an enhancement ;) |
Thanks for the report. Depends on the way you see it haha. It's a case that is not handled, but the library works as expected on more common use cases. Anyway, supporting this will probably make the code more complex and add some bytes to the final bundle. Feel free to open a PR to see this case supported so we can discuss about it being part of a next release. |
@francoischalifour There are generally two ways to fix this: you can either add Neither should add much complexity. |
I'm also seeing this, in my case with a 3rd party library ( |
Thank you all for your interest in this issue. I rather lean toward the CSS fix with You can expect this issue to be fixed in v1.0.5. Meanwhile, you can override the .medium-zoom-image {
transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) !important;
} |
**Description** This makes sure that the opening/closing transitions are triggered even though an image CSS `transition` is provided as inline style. This is problematic with frameworks that generate inline styles on their images (e.g. Gatsby). See full context in #110. **Solution** The CSS `transition` is marked as "!important" for the animation to happen even though it's overriden by another inline `transition` style attribute. **Related** Closes #110
**Description** This makes sure that the opening/closing transitions are triggered even though an image CSS `transition` is provided as inline style. This is problematic with frameworks that generate inline styles on their images (e.g. Gatsby). See full context in #110. **Solution** The CSS `transition` is marked as "!important" for the animation to happen even though it's overriden by another inline `transition` style attribute. **Related** Closes #110
This makes sure that the opening/closing transitions are triggered even though an image CSS `transition` is provided as inline style. This is problematic with frameworks that generate inline styles on their images (e.g. Gatsby). Closes #110
Released in 1.0.5 🎉 |
Bug description
If the image used for the zoom has a
transition
applied in itsstyle
attribute, the zoom will happen (but without animating thetransform
of the zoom image) but will be uncloseable sincemedium-zoom
never setsisAnimating = false
.This is because
medium-zoom
listens for thetransitionend
event, with no fallback. Since the target element is copied to create the zoom image, thestyle
attribute is copied too - and this is never overwritten (the transition defined bymedium-zoom
is done so in a stylesheet, and is therefore overwritten by thestyle
). Since this means that there's notransition: transform
, the transition never starts or ends, and notransitionend
event is emitted.How to reproduce
style="transition: opacity 0.5s"
or similarmedium-zoom(...)
on your imageExpected behavior
It works even if image has a
transition
set in itsstyle
.Reproducible example
Link to the bug reproduction
The text was updated successfully, but these errors were encountered: