Bootstrap carousel shows animation only in first slide

前端 未结 1 949
春和景丽
春和景丽 2021-01-16 18:45

My bootstrap carousel has 4 slides and all of them have animated charts but the animation is seen only in first slide. How do I ensure that the chart animations for the rest

相关标签:
1条回答
  • 2021-01-16 19:08

    You are creating the chart animation on window.onload.Copy the same to slid.bs.carousel event. Check the below snippet.

    $(".carousel").on('slid.bs.carousel', function (evt) {
    var myPie = new Chart(document.getElementById("canvas_Pie1c").getContext("2d")).Pie(mydata2, opt1c);
    var myPie = new Chart(document.getElementById("canvas_Pie2c").getContext("2d")).Pie(mydata2, opt1c);
    });
    
    0 讨论(0)
提交回复
热议问题