现在我的页面上有这个:
<section class="image_slider grid_4">
<nav class="slider_nav"> <a href="#" class="left"> </a> <a href="#" class="right"> </a> </nav>
<div class="slides">
<a href="/images/placeholders/800x600/7.jpg" rel="fancybox_gallery1"><img src="/images/placeholders/300x200/7.jpg" alt="" /></a>
<a href="/images/placeholders/800x600/8.jpg" rel="fancybox_gallery1"><img src="/images/placeholders/300x200/8.jpg" alt="" /></a>
</div>
控制它的js是这样的:
/* Sidebar image slider */
$('.image_slider').each(function () {
/* Functions */
function resetInterval () {
clearInterval(imageSliderInterval);
imageSliderInterval = setInterval(next, 4000);
}
function next () {
$('.image_slider .slides').children(':last').fadeOut(1000, function () {
$(this).prependTo('.image_slider .slides').fadeIn(1);
});
}
function previous () {
$('.image_slider .slides').children(':last').fadeOut(1000, function () {
$(this).prependTo('.image_slider .slides').fadeIn(1);
});
}
/* Initialize */
var imageSliderInterval;
resetInterval();
/* Controls */
$('.image_slider .left').click(function () {
next();
resetInterval();
});
$('.image_slider .right').click(function () {
previous();
resetInterval();
});
});
有什么想法可以让图像幻灯片放映的多个实例在每个图像库上都有单独的控件吗?
如果您想看一看,原始代码来自此模板 - 向下滚动到标题“Nam imperdiet lacinia”: