如何在javascript中自动增加 vidslide1.stopVideo(); ?
示例,
vidslide1.stopVideo();
vidslide2.stopVideo();
vidslide3.stopVideo();
...
vidslide10.stopVideo();
脚本:
$('#myCarousel').on('slide.bs.carousel', function () {
vidslide1.stopVideo();
vidslide2.stopVideo();
});
答案 0 :(得分:2)
欢迎使用数组
var vidarr = [vidslide1,vidslide2,vidslide3];
vidarr.forEach(function(v) { v.stopVideo(); });