我想阻止此功能运行:
$(document).on("click",".filters", function(event) {
$('.filters').removeClass('selectedFilter');
$(this).addClass('selectedFilter');
$('.filters div').not('.selectedFilter div').slideUp(200);
$('.selectedFilter div').animate({opacity:"toggle",height:"toggle"},200);
});
我已经尝试过 $(".filters").unbind("click")
,但这不起作用,我猜是因为我一开始是如何触发它的?
最佳答案
$(document).off("click", ".filters");
来自文档:
The .off() method removes event handlers that were attached with .on() and Event handlers attached with .bind() can be removed with .unbind()
关于javascript - 您可以取消绑定(bind)到文档的 jQuery 函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34743380/