如何解决jQuery 滑块不会循环
谁能帮我解决一个滑块问题?我从模板中获得了该代码。
带有此代码的滑块只是切换到第二个图像,然后停止。我有 3 张图片。滑块应该有一个无限循环。我找不到解决办法。试图更改一些设置,但我不是 javascript 专家。您知道我应该更改哪些设置才能使其正常工作吗?
})(Tc.$);
(function($) {
Tc.Module.FullscreenSlider = Tc.Module.extend({
init: function($ctx,sandbox,modId) {
this._super($ctx,modId);
},dependencies: function() {
// this.require('jquery.ui.core.js','plugin','onBinding');
},onBinding: function() {
var $ctx = this.$ctx;
var fullscreen_slide = function() {
$('.fullscreen_slideshow',$ctx).width($(window).width());
if( $ctx.hasClass('force')) {
$('.fullscreen_slideshow',$ctx).height($(window).height());
} else {
$('.fullscreen_slideshow',$ctx).height($(window).height() - $('.top-bar').height());
}
}
fullscreen_slide();
$(window).on('resize',fullscreen_slide);
var options = {
nextButton: true,prevButton: true,autoPlay: false,autoStop: true,autoPlayDelay: 2000,pauseButton: true,cycle: true,// preloader: true,animateStartingFrameIn: true,pagination: true,reverseAnimationsWhenNavigatingBackwards: true,preventDelayWhenReversingAnimations: true,fadeFrameWhenSkipped: false,swipeEvents: {
left: "next",right: "prev"
},pauseOnHover: false
}
var autostop = jQuery('.fullscreen_slideshow',$ctx).data('autostop') == 'on' ? true : false;
var timeout = jQuery('.fullscreen_slideshow',$ctx).data('timeout');
if ( timeout == '0' || !timeout ) {
options.autoPlay = true;
} else {
options.autoPlay = true;
options.autoPlayDelay = parseInt(timeout);
}
if ( autostop ) {
options.autoStop = true;
} else {
options.autoStop = true;
}
var fullscreen = jQuery(".fullscreen_slideshow",$ctx).sequence(options).data("sequence");
fullscreen.beforeCurrentFrameAnimatesOut = function() {
var sequence = this;
var removeStatic = function() {
jQuery(".frame.static").removeClass('static');
if ( !window.fullSequenceAutoStarted && sequence.settings.autoPlay ) {
sequence.startAutoPlay(sequence.settings.autoPlayDelay);
window.fullSequenceAutoStarted = true;
}
}
setTimeout(removeStatic,1000);
// when the next frame is the last one
if ( sequence.nextFrameID == sequence.frames.length && options.autoStop ) {
sequence.stopAutoPlay();
}
}
}
})
})(Tc.$);
有html代码:
<div class='fullscreen_slideshow' data-autostop='off'>
<a class='sequence-prev' href='javascript:void(0);'>
<span></span>
</a>
<a class='sequence-next' href='javascript:void(0);'>
<span></span>
</a>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。