[英]jQuery tab animation pause and play by controllers
我已经使用jQuery选项卡进行宣传,但是我需要具有播放和暂停之类的控制按钮。 以下是我的控件。
<p id="carusalSwitch">Autoplay
<span class="on">On</span> | <span class="off">Off</span>
</p>
然后浏览页面,暂停(停止)标签动画,通过按钮交互可以播放,反之亦然。 以下是查询代码,
// when loaded carousal is paused, off text is change to bold
$('#carusalSwitch .off').css('fontWeight','bold');
// when user click on "ON" link
$('#carusalSwitch .on').click(function() {
$('#featured > ul').tabs({fx:{opacity: 'toggle'}}).tabs('rotate', 3000, true);
$(this).css('fontWeight','bold');
$('#carusalSwitch .off').css('fontWeight','normal');
});
// when user click on "OFF" link
$('#carusalSwitch .off').click(function() {
$('#featured > ul').tabs();
$(this).css('fontWeight','bold');
$('#carusalSwitch .on').css('fontWeight','normal');
});
当您单击“打开”链接时,动画开始,但是当单击“关闭”时,动画仍然继续。 可能是什么错误?
即使我尝试添加以下代码,
$('#featured > ul').tabs().clearQueue().stop();
但没有运气。
尝试这个 :
$('#featured > ul').unbind('toggle').unbind('rotate');
$('#featured > ul').tabs('rotate', null, true);
当我如上所述使用时,它工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.