对不起,我这里有一个特定的问题,可能对其他人没什么帮助。或者也许不知怎的,我不确定。
我一直在搞乱这一切,这让我大吃一惊,因为图像都会褪色,一切都在变化和完美转换直到最后,最后的图像说出来了"感谢您查看"显示,但不是。这很奇怪,因为标题会像它应该的那样变成空白,我甚至在图像设置完成后发出警报,它会触发。在我放入褪色之前,结束幻灯片显示。所以我认为这是因为它已经消失了,所以我在它下面放了一个淡入淡出,但那没有做任何事情。我不知道,我不知所措。
这是我的网站,可以让您了解这里发生了什么。 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;
}
}
答案 0 :(得分:0)
如果random是未定义的意味着输入也是未定义的,那么如何将一个新的var命名条目放入检查内部呢!
if (random == undefined) {
var entry = {image : "end.png", artist : "null", caption : "null"};
}
然后删除
if (random != undefined) {}
希望有所帮助!
答案 1 :(得分:0)
啊,所以,我认为一旦输入未定义,它就会从任何一个点输入中停止运行该功能。我错了。我认为。但无论如何,我重新排序它以确定在定义随机时引入条目的点,因此它不能覆盖我的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);
}