当单击 btnNext 时,我试图让我的变量增加。然后,当计数器达到我的数组长度时,我想重定向到另一个页面。因此,当显示最后一张图像并且 btnNext 再次触发时,它将重定向,但我无法使其正常工作。
我试过使用 do/while 循环..
$(function () {
var myLiCount = $("li").length;
var counter = 1;
do {
$(".nonCircular .carousel").jCarouselLite({
btnNext: ".next",
visible: 1,
circular: false
});
counter = counter + 1;
} while (counter != myLiCount);
window.location.href('http://www.google.com');
});
所做的只是显示图像 2 秒钟然后重定向,所以我尝试了这个......
$(function () {
var myLiCount = $("li").length;
var counter = 1;
$(".nonCircular .carousel").jCarouselLite({
btnNext: ".next",
visible: 1,
circular: false
});
counter = counter + 1;
if(counter == myLiCount)
window.location.href('http://www.google.com');
});
但这也不起作用,它会到达最后一张图像,之后什么也不做。
我知道要让它工作,我必须以某种方式增加 btnNext 点击,但不知道如何。
谢谢