【发布时间】:2021-01-18 20:07:11
【问题描述】:
我目前有一个图像幻灯片,其中有随机图像,但我似乎无法找到一种方法来阻止图像在开始时加载并应用随机过渡。 有人可以帮忙吗? 谢谢。
pre><html>
<head>
<title>change picture</title>
<script type = "text/javascript">
function displayNextImage() {
x = (x === images.length - 1) ? 0 : x + 1;
document.getElementById("img").src = images[x];
}
function startTimer() {
setInterval(displayNextImage, 4000);
}
var trans=[
];
var images = [
"https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/10.png" ,
"https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/11.png" ,
"https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/12.png" ,
"https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/13.png" ,
"https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/14.png"
], x = -1;
</script>
</head>
<body onload = "startTimer()">
<img id="img" src="https://cosecha-verde.000webhostapp.com/images/Centro/2016-2017/1.png" data-transition="slideInLeft" />
</body>
</html>
【问题讨论】:
-
图片11和14不存在!
标签: javascript performance image-processing css-transitions slideshow