(点击、项目点击等)
发布于 2012-12-25 19:04:43
点击事件不会直接作用于组件。相反,它们在组件的元素上工作得很好。因此,对于您的情况,您可以这样使用它:
在你的控制器的“控制”中,
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);
}
}
}如果您只想在某些类型的元素上捕获点击事件,则可以使用委托:
carousel.element.on('tap', function(e, el){
// Here you will get the target element
console.log(e.target, el);
}, this, {
delegate : 'div.my-element'
});希望这能有所帮助。
https://stackoverflow.com/questions/14029292
复制相似问题