我已经使用了这个站点http://www.joezimjs.com/demos/roundabout-demo/的圆形滑块,我只需要在旋转器中显示三个图像。如果我使用超过 7 张图像,则旋转器中有 5 张图像。可能有任意数量的图像,但应在旋转器中显示三个。如何解决这个问题?
脚本:
(function($) {
var $descriptions = $('#carousel-descriptions').children('li'),
$controls = $('#carousel-controls').find('span'),
$carousel = $('#carousel')
.roundabout({childSelector:"a", minOpacity:1, autoplay:true, autoplayDuration:5000, autoplayPauseOnHover:true })
.on('focus', 'a', function() {
var slideNum = $carousel.roundabout("getChildInFocus");
$descriptions.add($controls).removeClass('current');
$($descriptions.get(slideNum)).addClass('current');
$($controls.get(slideNum)).addClass('current');
});
$controls.on('click dblclick', function() {
var slideNum = -1,
i = 0, len = $controls.length;
for (; i<len; i++) {
if (this === $controls.get(i)) {
slideNum = i;
break;
}
}
if (slideNum >= 0) {
$controls.removeClass('current');
$(this).addClass('current');
$carousel.roundabout('animateToChild', slideNum);
}
});
}(jQuery));