If original image has a transition, zoom becomes uncloseable
See original GitHub issueBug description
If the image used for the zoom has a transition
applied in its style
attribute, the zoom will happen (but without animating the transform
of the zoom image) but will be uncloseable since medium-zoom
never sets isAnimating = false
.
This is because medium-zoom
listens for the transitionend
event, with no fallback. Since the target element is copied to create the zoom image, the style
attribute is copied too - and this is never overwritten (the transition defined by medium-zoom
is done so in a stylesheet, and is therefore overwritten by the style
). Since this means that there’s no transition: transform
, the transition never starts or ends, and no transitionend
event is emitted.
How to reproduce
- Create an image with
style="transition: opacity 0.5s"
or similar - Run
medium-zoom(...)
on your image - Click the image - the zoom will open instantly and become uncloseable
Expected behavior
It works even if image has a transition
set in its style
.
Reproducible example
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
CSS transition effect makes image blurry / moves image 1px ...
I'm on Chrome 27 on OSX, and it's fine. I believe that when the content gets put into a layer it gets turned...
Read more >Zooming Methods - Tutorialspoint
The above image has two rows and two columns, we will first zoom it row wise. Row wise zooming: When we zoom it...
Read more >TVPaint Animation 11 changelogs (latest update 2022_12_07)
Image marks are now undoable. An option has been added to remove loaded soundtrack history. You can now merge two layers when right...
Read more >2020-Minolta_MN67Z_User-Manual.pdf - Squarespace
This manual provides you with instructions on how to use your new MINOLTA MN67Z. Digital Camera. Every effort has been made to ensure...
Read more >Animation Composite | Unreal Engine 4.27 Documentation
Animation Composites can also have their own sets of Notifies and Curves. ... of this AnimSequence if played back with a speed of...
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 FreeTop 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
Top GitHub Comments
I’m also seeing this, in my case with a 3rd party library (
gatsby-image
) where I have no control over the transitions defined. Either one of the patches mentioned by @birjolaxew would be great, even as opt-in behaviour@francoischalifour There are generally two ways to fix this: you can either add
!important
to the transition you define in your stylesheet (in which case it still breaks if the user adds atransition: ... !important
, but y’know, that’s pretty edge case), or you can explicitly set the transition on the cloned element e.g.active.zoomed.style.transition = "transform 300ms cubic-bezier(0.2, 0, 0.2, 1)";
Neither should add much complexity.