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

Maybe touch-action:none; only after first Zoom Event ? #36

Open
VonZubinski opened this issue Oct 30, 2023 · 1 comment
Open

Maybe touch-action:none; only after first Zoom Event ? #36

VonZubinski opened this issue Oct 30, 2023 · 1 comment

Comments

@VonZubinski
Copy link

I would really like to use Zoomist in a current project, unfortunately, if implement on mobile the whole image container becomes a "deadzone" for scrolling. Especially when a bigger portrait image occupies a lot of screen real estate, the user has to search for some left over whitespace to continue scrolling.

To counter this problem, I was planning to set the container class to touch-action: manipulation; and change it to none in case of a zoom event.

From my understanding, I would have to give every container some kind of id-name and have it initialised separately.
Is it possible, to keep that naming global and trigger that css change with zoom(zoomist, scale) {...} only for the zoomist-container that is being used ?

@cotton123236
Copy link
Owner

This is indeed a tricky situation, because set touch-action to none is necessary for zooming or dragging on mobile devices.

On current situation, maybe you can try these following code:

const containers = document.querySelectorAll('.zoomist-container')
containers.forEach(container => {
  new Zoomist(container, {
    on: {
      zoom() {
        container.style.setProperty('touch-action', 'none')
        // or what you plan to do
      }
    }
  })
})

I will try to find a solution to this problem and maybe fix it in the next version.
Thanks!

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