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 the wrapper handle enabling of pinch? #43

Open
aicm opened this issue Nov 13, 2015 · 4 comments
Open

does the wrapper handle enabling of pinch? #43

aicm opened this issue Nov 13, 2015 · 4 comments

Comments

@aicm
Copy link

aicm commented Nov 13, 2015

Hi there,

I was looking at the wrapper but I can't see where and how to pass the .add(pinch) to the manager. I'm also no good at JS syntax so that might be why.

@aicm
Copy link
Author

aicm commented Nov 14, 2015

Well, here's a hacky method of doing this, should anyone else bump into this isuse:

//on pinch, do something
    var myIdContainer = $("#yourIDhere");

    myIdContainer.hammer({
        //this is the regular hammer(options) in the wrapper
        //touchAction: 'pan-y'
    });
    //this is a hacky way to enable the second recognizer which is "pinch"
    myIdContainer.data("hammer").recognizers[1].options.enable = true;

        //now that the option is set, you can bind the "pinch" event(s)
    myIdContainer.bind("pinchout", function(ev) {
        //do something on pinchout
    });

@eblin
Copy link

eblin commented Nov 30, 2015

@aicm you can pass your recognizers in the options

myContainer
            .hammer({
                recognizers: [
                    // RecognizerClass, [options], [recognizeWith, ...], [requireFailure, ...]
                    [Hammer.Pinch, { enable: true }],
                    [Hammer.Swipe,{ direction: Hammer.DIRECTION_HORIZONTAL }]
                ]
            }).on('pinchout swipeleft swiperight', function(){ ... });

@aicm
Copy link
Author

aicm commented Dec 1, 2015

@eblin awesome! Thank you 👍

@kxgio
Copy link

kxgio commented Jan 10, 2016

@eblin Thank you.

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

3 participants