Bootstrap Carousel with dynamic items does not slide

后端 未结 5 759
野的像风
野的像风 2020-12-31 08:43

I\'m using the stock bootstrap carousel:

<
5条回答
  •  有刺的猬
    2020-12-31 09:10

    Try this code:

    //json data result = [{"id_img": 17,"img_filename": "ca0d8455-2702-4560-a444847429e36670.jpg"},{"id_img": 18,"img_filename": "eb0c6c77-fbd7-4f2c-bf22-10c874eefbf6.jpeg"},{"id_img": 19,"img_filename": "e7568c87-babb-4049-aed6-27b97866a817.png"}]
        var x = $.getJSON('../Json/GetImage', function (data) {
          $("#myCarousel").carousel("pause").removeData();
          var content_indi = "";
          var content_inner = "";
          $.each(data, function (i, obj) {
            content_indi += '
  • '; content_inner += '
    '; }); $('#car_id').html(content_indi); $('#car_inner').html(content_inner); $('#car_inner .item').first().addClass('active'); $('#car_indi > li').first().addClass('active'); $('#myCarousel').carousel(); });

提交回复
热议问题