简体   繁体   中英

how to remove bootstrap carousel

I am trying to remove bootstrap carousel on a button click and displaying all the lists in carousel

this is how it look before: 在此处输入图片说明

after i executed this code:

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

this is how it look after; 在此处输入图片说明

all events of bootstrap carousel events are still associated with it. How to remove all these events?

You can remove event click or any other associated event to this element like so:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM