[英]My final image in a slideshow of randomized images doesn't show
抱歉,我在这里有一个特定的问题,可能对其他人没有太大帮助。 也许不知何故,我不确定。
我整夜都在混乱中,这让我很震惊,因为图像全部消失了,一切都完美地变化并过渡到最后,最后显示出“感谢您观看”的图像,除了不是。 这很奇怪,因为标题会像应有的那样变成空白,并且在设置图像后我什至发出警报,然后触发。 在我淡入淡出之前,正在显示最后一张幻灯片。 所以我想这是因为它被淡出了,所以我在它下面放了一个淡入淡出,但是什么也没做。 我不知道,我很茫然。
这是我的网站,可让您大致了解这里的情况。 http://www.dreamquest.io
/* this is the first function that is fired though I've moved it after the next function just
to be chronological, but no luck with the issue at hand */
function removeImage(){
document.getElementById("all").onclick = "";
document.getElementById("remove").onclick = "";
$("#image").fadeTo(2000,0, changeImage);
}
function changeImage(){
var random = mix.pop();
var entry = backInfo[random];
if (random == undefined) {
document.getElementById("caption").textContent = "";
/* end.png is the last image in the slideshow that isn't showing up */
document.getElementById("image").src = "end.png";
$("#image").fadeTo(1000,1);
}
document.body.style.textShadow = "1px 1px 7px #000";
document.getElementById("all").style.backgroundImage = "url(" + entry.image + ")";
document.getElementById("image").src = entry.image;
document.getElementById("artist").href = entry.artist;
document.getElementById("caption").textContent = entry.caption;
if (random != undefined) {
/* I've even amde sure that random is in fact undefined at the last slide */
var image = new Image();
image.onload = function () {
$("#image").fadeTo(1000,1);
document.getElementById("all").onclick = removeImage;
document.getElementById("remove").onclick = removeImage;
}
image.src = entry.image;
}
}
如果random是undefined,则意味着entry也未定义,那么如何像新建的var条目那样将检查放入内部!
if (random == undefined) {
var entry = {image : "end.png", artist : "null", caption : "null"};
}
然后删除
if (random != undefined) {}
希望有帮助!
嗯,所以,我以为一旦定义了条目,就从出现任何点条目开始就停止运行该功能。 我错了。 我认为。 但是无论如何,我对它进行了重新排序以隔离定义随机数时进入条目的点,因此它无法覆盖我的end.png,并且有效!!!
function changeImage(){
var random = mix.pop();
var entry = backInfo[random];
if (random == undefined) {
document.getElementById("caption").textContent = "";
document.getElementById("image").src = "end.png";
$("#image").fadeTo(1000,1);
}
if (random != undefined) {
var image = new Image();
image.onload = function () {
$("#image").fadeTo(1000,1);
document.getElementById("all").onclick = removeImage;
document.getElementById("remove").onclick = removeImage;
}
image.src = entry.image;
document.body.style.textShadow = "1px 1px 7px #000";
document.getElementById("all").style.backgroundImage = "url(" + entry.image + ")";
document.getElementById("image").src = entry.image;
document.getElementById("artist").href = entry.artist;
document.getElementById("caption").textContent = entry.caption;
}
}
function removeImage(){
document.getElementById("all").onclick = "";
document.getElementById("remove").onclick = "";
$("#image").fadeTo(2000,0, changeImage);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.