不停止jQuery滑块
我正在使用切片图像制作一个jQuery滑块,使其看起来像一个looong滑动横幅: 示例: 我有两个问题: 1) 序列中的第三个图像加载太晚 2) 它在幻灯片之间停止-但我也不想要它 你知道为什么吗?谢谢:)不停止jQuery滑块,jquery,css,Jquery,Css,我正在使用切片图像制作一个jQuery滑块,使其看起来像一个looong滑动横幅: 示例: 我有两个问题: 1) 序列中的第三个图像加载太晚 2) 它在幻灯片之间停止-但我也不想要它 你知道为什么吗?谢谢:) 所有东西都更新了…我看不到延迟加载的图像,线性宽松似乎很好。。。编辑:好的,现在我知道了see@Dave如果这个答案有帮助,就投票吧。如果它解决了您的问题,请将其标记为已接受谢谢-这很好。面板2在第一次旋转时重复自身,但。。。 var showing = 0, // current img
所有东西都更新了…我看不到延迟加载的图像,线性宽松似乎很好。。。编辑:好的,现在我知道了see@Dave如果这个答案有帮助,就投票吧。如果它解决了您的问题,请将其标记为已接受谢谢-这很好。面板2在第一次旋转时重复自身,但。。。
var showing = 0, // current img
imgs = [], // all imgs
$img = $("#gallery img"), // jQuery DOM object
imgWidth = $img.outerWidth(), // img width assuming every img has same
$slider = $("#slider"),
$title = $("#title");
imgs = $img.toArray();
// Variable to store number of images
var numberOf = imgs.length;
// set slider width so floated elements line up
$slider.width(numberOf*imgWidth);
// Recursive next image function
var nextImage = function() {
var $nextImg = $(imgs[showing++ % numberOf]);
// Add next image (only use increment once!)
$slider.append($nextImg);
// Show image title
$title
.html($nextImg.attr("title"))
.attr("href", $nextImg.attr("src"));
// Animate the slider
$slider.animate({
left: '-='+imgWidth
}, 8000, 'linear', function() {
// Reset CSS
$slider.css("left", 0);
// Call animationg function again
nextImage();
});
}
// Call next image for the first time
nextImage();