我使用了“为什么这个幻灯片闪烁?”代码。哪些彼得已经给你的答案在网站上,它的工作完全正常,没有任何闪烁,但我的问题是如何添加超链接到每个图像。 我已经粘贴代码,供大家参考如何添加链接到幻灯片中的每个图像?
脚本
(function() {
// ------
// ###### Edit these.
// Assumes you have images in path named 1.jpg, 2.jpg etc.
var imagePath = "images";
var lastImage = 5;
// How many images do you have?
var fadeTime = 4000;
// var index=1;
// Time between image fadeouts.
// ------
// ###### Don't edit beyond this point.
// No need for outer index var
function slideShow(index) {
var url = imagePath + "/" + index + ".jpg";
// Add new image behind current image
$("#slideShow").prepend($("<img/>").attr("src",url));
// Fade the current image, then in the call back
// remove the image and call the next image
$("#slideShow img:last").fadeOut("slow", function() {
$(this).remove();
setTimeout(function() {
slideShow((index % lastImage) + 1)
}, fadeTime);
});
}
$(document).ready(function() {
// Img 1 is already showing, so we call 2
setTimeout(function() { slideShow(2)}, fadeTime);
delay(1000);
}); })();
</script>
请帮助.................
DalexL谢谢回答我,你有上面给出的代码将所有的图像链接到同一“www.google.com”,但我需要不同的链接为每个图像。 – 2011-04-15 17:08:34
你知道这种语言有多少?难道你不能使用某种简单的if语句或从文件中读取数据来确定链接吗?我的例子只是例子。为什么把每个人都发送到谷歌:P(这是一个很棒的网站,虽然:3) – FreeSnow 2011-04-15 19:56:44
我尝试插入你之前说过的线路并没有解决问题。该图像没有显示任何链接。 – 2011-04-15 20:26:49