所以现在我使用hammer.js将一些触摸控件绑定到页面上的元素。通过向元素上的右侧滑动,它将添加禁用的类。如果任何项目具有禁用的类别,本质上,我只想为该类别禁用的元素“解除绑定”双击和swiperight事件。有谁知道这是否可能?stopPropagation()只有一个元素
$('.row').hammer({
prevent_default: false,
drag_vertical: false
}).bind('doubletap swiperight', function(e) {
var $this = $(this)
if (e.type == "doubletap") {
confirm("Do You Want To Edit Med?")
}
else if (e.type == "swiperight") {
$this.removeClass('yHighlight');
$this.addClass('gHighlight disabled');
$this.css('opacity','.5')
}
});
您的标题显示“stopPropagation”(停止冒泡事件),但您的问题描述了禁用元素本身的行为。你究竟想要什么? – 2012-04-16 22:07:47