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

Does not work/update with responsive images #39

Open
MickL opened this issue Aug 29, 2019 · 1 comment
Open

Does not work/update with responsive images #39

MickL opened this issue Aug 29, 2019 · 1 comment

Comments

@MickL
Copy link

MickL commented Aug 29, 2019

On change of image-size the script needs to recalculate the width/height of the image. Currently the background size stays the same.

A typical usecase is having a responsive image like max-width: 100%; height: auto;.

@Andi-Lo
Copy link

Andi-Lo commented Apr 9, 2021

I experienced the same problem, that there is no way to update the "width" property of wheelzoom. As a workaround I am using a ResizeObserver on the image element and trigger a fresh init like this:

    const obs = new ResizeObserver((entries) => {
      entries.forEach((entry) => {
        imgElement.src = myImageSource; // my source is a base64 encoded string
        imgElement.dispatchEvent(new Event('load'));
      });
    });

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