如何删除bootstrap轮播

时间:2016-12-27 08:42:50

标签: javascript jquery twitter-bootstrap

我试图在按钮点击上删除bootstrap轮播并在轮播中显示所有列表

以前的表现如下: enter image description here

执行此代码后:

  $('#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');
    });

这就是它的照顾方式; enter image description here

bootstrap轮播事件的所有事件仍然与之关联。 如何删除所有这些事件?

1 个答案:

答案 0 :(得分:4)

您可以将事件click或任何其他相关事件移除到此元素,如下所示:

$("#carousel-on-22").unbind(); //Remove all events
$("#carousel-on-22").unbind('click'); //Remove `click` event only