1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    26
    Vote Rating
    0
    Answers
    1
    Rhogar is on a distinguished road

      0  

    Exclamation Answered: Accessing default event swipe handler

    Answered: Accessing default event swipe handler


    Hi guys, I've got a carousel panel with html content loaded in, and I've set it up so on render, it has the el.on event of double tap
    e.el.on("doubletap",functionx(e){});
    Which works wonderfully, except that now the swipe is disabled for the panel. Any idea why or how to fix it so the doubletap stays in place but the default swipe events still apply?

    Any help is much appreciated!

    Cheers

  2. This is working for me without interrupting the swipe event of the carousel:

    Code:
    new Ext.Carousel({
        fullscreen : true,
        items      : [
            {
                html : 'Hi'
            },
            {
                html : 'Hello'
            }
        ],
        listeners : {
            afterrender: function(carousel) {
                carousel.el.on('doubletap', function() {
                    console.log('doubletap on carousel')
                });
    
                var items = carousel.query('panel');
    
                items[0].el.on('doubletap', function() {
                    console.log('doubletap on first')
                });
    
                items[1].el.on('doubletap', function() {
                    console.log('doubletap on second')
                });
            }
        }
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This is working for me without interrupting the swipe event of the carousel:

    Code:
    new Ext.Carousel({
        fullscreen : true,
        items      : [
            {
                html : 'Hi'
            },
            {
                html : 'Hello'
            }
        ],
        listeners : {
            afterrender: function(carousel) {
                carousel.el.on('doubletap', function() {
                    console.log('doubletap on carousel')
                });
    
                var items = carousel.query('panel');
    
                items[0].el.on('doubletap', function() {
                    console.log('doubletap on first')
                });
    
                items[1].el.on('doubletap', function() {
                    console.log('doubletap on second')
                });
            }
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    26
    Vote Rating
    0
    Answers
    1
    Rhogar is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    This is working for me without interrupting the swipe event of the carousel:

    Code:
    new Ext.Carousel({
        fullscreen : true,
        items      : [
            {
                html : 'Hi'
            },
            {
                html : 'Hello'
            }
        ],
        listeners : {
            afterrender: function(carousel) {
                carousel.el.on('doubletap', function() {
                    console.log('doubletap on carousel')
                });
    
                var items = carousel.query('panel');
    
                items[0].el.on('doubletap', function() {
                    console.log('doubletap on first')
                });
    
                items[1].el.on('doubletap', function() {
                    console.log('doubletap on second')
                });
            }
        }
    });
    Much appreciated! All sorted now. Not sure exactly why, but placing the double tap event on the panel within the carousel conflicted, so I took that back out onto the carousel and it still worked perfectly and didn't override the swiping!