Tap event for Ext.carousel.Carousel

廉价感情. 提交于 2019-12-23 00:48:56

问题


There seems to be no tap event for Ext.carousel.Carousel. How can I make a carousel respond to tap events? (tap, itemtap etc.)


回答1:


Tap events do not work on the components directly. Instead they work fine on component's element. So, for your case you can use it like this:

In your controller's "control",

control : {
     // Your carousel reference
    "carousel" : {
         initialize : function(carousel){
             carousel.element.on('tap', function(e, el){
                 // Here you will get the target element
                 console.log(e.target, el);
             }, this);
         }
     }
}

You can use delegate this way if you want to capture tap event on certain types of element only:

carousel.element.on('tap', function(e, el){
    // Here you will get the target element
    console.log(e.target, el);
}, this, {
    delegate : 'div.my-element'
});

Hope this help.



来源:https://stackoverflow.com/questions/14029292/tap-event-for-ext-carousel-carousel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!