我已经使用了这个站点上的round about slider 。
如果我将鼠标悬停在幻灯片上,则自动旋转停止。我需要链接stop
。auto play
on click
Stop auto play
我的html代码:
<div id="carousel">
<a href="#"><img src="image_main1.jpg" alt=""></a>
<a href="#" ><img src="image_main2.jpg" alt=""></a>
<a href="#" ><img src="image_main3.jpg" alt=""></a>
</div>
<div id="carousel-controls">
<span class="control current"><img src="video_thumb1.jpg" alt=""></span>
<span class="control"><img src="video_thumb.jpg2" alt=""></span>
<span class="control"><img src="video_thumb.jpg3" alt=""></span>
</div>
<div><a href="#">Stop auto play</a></div>
我的脚本:
(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));
怎么做?