Giter Site home page Giter Site logo

Comments (12)

payalord avatar payalord commented on July 30, 2024

I think this happens because there is event attached on scroll for scale by default, which useful for desktop version. But for touch devices it is not useful completely, because on touch devices there is no mouse. So scale better to reattach to pinch gesture instead.
I will create an example today later in sandbox to illustrate this approach.

from xzoom.

Budapresst avatar Budapresst commented on July 30, 2024

from xzoom.

Budapresst avatar Budapresst commented on July 30, 2024

from xzoom.

payalord avatar payalord commented on July 30, 2024

I'm sorry, really had a lot of work to do this week.

from xzoom.

payalord avatar payalord commented on July 30, 2024

Will try on this weekend.

from xzoom.

Budapresst avatar Budapresst commented on July 30, 2024

from xzoom.

payalord avatar payalord commented on July 30, 2024

I have added example with Hammer.js version 2, to xzoom-sandbox repository here: https://github.com/payalord/xzoom-sandbox/tree/master/Hammer.jsV2

Which available to check and test now from mobile by this link: https://payalord.github.io/xzoom-sandbox/Hammer.jsV2/

To fix scroll issue, it is required to use touchAction, but unfortunately Hammers option touchAction is not working as declared, I tested it several times, need to report them about that, but this is another story. The only thing right now that is matter is this:

Chrome 35+, IE10+ and soon FireFox, support the touch-action property. This property tells the browser how to handle touches on an element. It improves the detection and experience of the gestures a lot, because it can prevent scrolling of the page without any JavaScript has to be executed, which can be too late in some cases.

Hammer uses a javascript fallback for this property when needed, so it is working with non-supporting browsers too. Still, on some (unpopular) devices the fallback might not work as good as the native support.

So i fixed scroll by manually adding touch-action: pan-x via jQuery to the required element on pan event.

Also this example is not prefect. Because the behaviour of how exactly must be done interaction with mobile gestures depends on developer preferences. In my example i decided to use approach like first tap is opening zoom, then pan available to move image inside zoom area and then second tap will close zoom.

from xzoom.

Budapresst avatar Budapresst commented on July 30, 2024

from xzoom.

payalord avatar payalord commented on July 30, 2024

I assume that issue is fixed.

from xzoom.

Budapresst avatar Budapresst commented on July 30, 2024

from xzoom.

pflind avatar pflind commented on July 30, 2024

@payalord and @Budapresst, it looks like this fix does not work on Android, only iOS. I tested with Chrome 42 under an older Android version. Zoom is initiated but you can't see the lens or move the lens around, it is stuck in the top left corner.

from xzoom.

payalord avatar payalord commented on July 30, 2024

Must be new version of hammer.js not working on old version of chrome. Need test with hammer.js v1.

from xzoom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.