的事情是http://jsfiddle.net/hTZWq/2/幻灯片链接,滑动按钮
$(".image").wrap("<a href=\"link.html\"></a>");
我想,所以当PIC改变它有链接,每个图片把这些变种的链接。 与这些代码我的按钮不工作在我的电脑bur在这里他们的小提琴工作?!奇怪。
它不断改变我的第一张照片与这些间隔功能。
有人可以帮忙!
的事情是http://jsfiddle.net/hTZWq/2/幻灯片链接,滑动按钮
$(".image").wrap("<a href=\"link.html\"></a>");
我想,所以当PIC改变它有链接,每个图片把这些变种的链接。 与这些代码我的按钮不工作在我的电脑bur在这里他们的小提琴工作?!奇怪。
它不断改变我的第一张照片与这些间隔功能。
有人可以帮忙!
如何存储的图像是这样的:
var image = [
{src: "pretend this is an image", link: "http://www.google.com"},
{src: "and lets pretend this is another", link: "http://www.yahoo.com"},
{src: "and one more for show", link: "http://www.stackoverflow.com"}
];
然后你就可以改变你的HTML()方法生成的标记时,在image.src
和image.link
性能通过。
你可以试试这个代码:
HTML
<a href="link1.html" class="picture">pretend this is an image</a>
<div class="bullet">click here to change manually</div>
的jQuery:
$(document).ready(function() {
setInterval(function() { //change this to setInterval to make it constantly flip through rather than one time
change();
}, 2400);
});
var image = [
["pretend this is an image", "link1.html"],
["and lets pretend this is another", "link2.html"],
["and one more for show", "link3.html"]
];
var index = 1;
$(".bullet").click(function() {
change();
});
function change() {
if (index == 3) {
index = 0;
}
$(".picture").fadeOut(1000, function() {
$(".picture").html(image[index][0]);
$(".picture").attr("href", image[index][1]);
$(".picture").fadeIn(1000);
index++;
});
}
我是一个初学者,所以有点难以忽略,你在说什么:/,那部分是“然后你可以改变你的html()方法在生成标记时传递image.src和image.link属性。 “ – Mario