#wss1 {
opacity:0;
-webkit-transition: opacity 1.0s linear 0s;
transition: opacity 1.0s linear 0s;
}
在wss1_array
中,如果我放置图像,而不是下面数组中的第一个视频,那么代码开始工作,否则当我放入视频时(如下面给出的数组),那么这个数组就会停止工作。 / p>
var wss1_i = 0;
var wss1_array = [
"<video src=\"stories-vid.mp4\" height=\"510\" width=\"1100\" controls=\"controls\" tabnew=\"0\" autoplay=\"autoplay\" loop=\"loop\"></video>",
"<img src=\"motion-1.jpg\" height=\"510\" width=\"1100\" /><h1>Add movement</h1><h3>Upload a sequence of five or more photos and get a fun, animated GIF. Magic!</h3>",
"<img src=\"motion-3.jpg\" height=\"510\" width=\"1100\" /><h1>Add movement</h1><h3>Upload a sequence of five or more photos and get a fun, animated GIF. Magic!</h3>",
"<img src=\"motion-5.jpg\" height=\"510\" width=\"1100\" /><h1>Add movement</h1><h3>Upload a sequence of five or more photos and get a fun, animated GIF. Magic!</h3>",
];
var wss1_elem;
function wss1Next(){
wss1_i++;
wss1_elem.style.opacity = 0;
if (wss1_i > (wss1_array.length - 1)) {
wss1_i = 0;
}
setTimeout('wss1Slide()',1000);
}
function wss1Slide(){
wss1_elem.innerHTML = wss1_array[wss1_i];
wss1_elem.style.opacity = 1;
setTimeout('wss1Next()',2000);
}
<body>
<div align="center" style="padding-top:40px;">
<span id="wss1"></span>
</div>
<script>
wss1_elem = document.getElementById("wss1"); wss1Slide();
</script>
</body>
如果我将所有4个图像放入数组中,那么代码将以1个视频和3个图像工作,但它不起作用。任何人都可以帮我吗?