我试图在按钮点击上删除bootstrap轮播并在轮播中显示所有列表
执行此代码后:
$('#carousel-on-22').removeAttr('data-ride');
$('#carousel-on-22').children().removeAttr('role');
$('#carousel-on-22').children().removeAttr('class');
$('#carousel-on-22').removeAttr('class');
$('#carousel-on-22').children().children().each(function () {
$(this).removeClass('carousel-item');
$(this).removeClass('active');
});
bootstrap轮播事件的所有事件仍然与之关联。 如何删除所有这些事件?
答案 0 :(得分:4)
您可以将事件click
或任何其他相关事件移除到此元素,如下所示:
$("#carousel-on-22").unbind(); //Remove all events
$("#carousel-on-22").unbind('click'); //Remove `click` event only