Skip to content
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

Allow for disabling default setting #8

Closed
E-VANCE opened this issue May 26, 2017 · 2 comments
Closed

Allow for disabling default setting #8

E-VANCE opened this issue May 26, 2017 · 2 comments

Comments

@E-VANCE
Copy link

E-VANCE commented May 26, 2017

Hi there,

am using your plugin on a site of mine and everything works fine so far (great suite!) but there is one issue / quetsion I am facing:

How can I (globally) set the plugin's setting to not select any images by default and only work with what I am providing?

By default, the zoom is applied to all scaled images (with HTML or CSS properties). You can specify the zoomable images with a CSS selector and add options.

Specyfing zoomable images only adds to the default selection, at least when I tried...

mediumZoom(document.querySelectorAll('[data-action="zoom"]'));

Thanks for any input on how to achieve this!

EDIT: Might be connected to #7 since it is triggering on my SVG? No tag as parent or anywhere near that SVG though...

<svg id="open-slash" data-name="open-slash" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.08 13.28" class="medium-zoom-image"><path class="slash" d="M148.58,282.81h-1.16l7.91-13.28h1.16Z" transform="translate(-147.41 -269.53)"></path></svg>

@francoischalifour
Copy link
Owner

Hi @E-VANCE, thanks for the feedback!

After investigating, you're totally right. The isArrayLike function, which is in charge of detecting NodeLists and HTML Collections is broken.

That's the reason why it falls back to SUPPORTED_FORMATS, which contains svgs.

I've fixed the issue but will spend more time thinking about any possible breaking changes. I'll publish the fix in the next days.

Thanks again 👍

francoischalifour added a commit that referenced this issue May 31, 2017
`SUPPORTED_FORMATS` is now only applied when the plugin is given no selector (#7).

Handle NodeLists, HTMLCollections and Nodes better. Remove default
support for SVG tags that don't support `naturalWidth` (#8).
@francoischalifour
Copy link
Owner

It should be fixed now. Please let me know if you find any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants