Closed gpetrioli closed 7 years ago
Perhaps a solution would be to use replaceWith
on the parent element if it is .magnify
Thanks, good catch. I don't use v3 myself, which still works in most cases since jQuery probably just ignores the unwrap()
selector for v1 and v2, until we encounter the scenario you mentioned.
I will also add logic to skip destroying the zoom if the image has no zoom to begin with.
When the image is not found the code that wraps the image in the
<div class="magnify"></div>
is not run (since that code is executed on theload
event of the image).But on resize the destroy is executed which unwraps the image. The code uses
.unwrap('.magnify')
, but using a selector is only introduced in jQuery v3.0 (https://api.jquery.com/unwrap/#unwrap-selector)