Add slides to Bootstrap 3 carousel dynamically using jQuery

后端 未结 4 1748
执笔经年
执笔经年 2020-12-01 06:30

I\'m trying to add slides to Bootstrap carousel using jQuery but it is not acting as a slider in the browser. Instead it\'s showing the images in list view.

         


        
4条回答
  •  余生分开走
    2020-12-01 07:17

    You can give this a try.

    Markup

    
    

    JS

    var markup = '';
    for (var index = 0; index < count; index++) {
        markup += '
  • '; } $('#carousel-deck .carousel-indicators').html(markup); markup = ''; for (var index = 0; index < count; index++) { markup += '
    '; markup += '' markup += '
    '; } $('#carousel-deck .carousel-inner').html(markup); $('#carousel-deck .item').first().addClass('active'); $('#carousel-deck .carousel-indicators > li').first().addClass('active'); $('#carousel-deck').carousel({ pause: true, interval: false });

提交回复
热议问题