Skip to content

Problem when image is not found #29

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

Closed
gpetrioli opened this issue Nov 24, 2016 · 2 comments
Closed

Problem when image is not found #29

gpetrioli opened this issue Nov 24, 2016 · 2 comments

Comments

@gpetrioli
Copy link
Contributor

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 the load 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)

@gpetrioli
Copy link
Contributor Author

Perhaps a solution would be to use replaceWith on the parent element if it is .magnify

@thdoan
Copy link
Owner

thdoan commented Nov 25, 2016

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.

@thdoan thdoan closed this as completed in 86abe10 Nov 25, 2016
thdoan added a commit that referenced this issue Nov 25, 2016
Fixes #29 - unwrapping wrong elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants