2
我正在使用一個網站的jQuery插件,我不是最好的JavaScript。在這段代碼中,腳本循環中的內容是什麼,我可以在哪裏停止它?我不知道在哪裏/如果從這個腳本,或者如果未來我應該尋找別的地方...使用serialScroll jQuery插件停止頁面循環
jQuery(function($){
var $slideshow = $('#slideshow');
var $homeslidernav = $('#navigation li button');
var $prev = $('button.prev');
var $next = $('button.next');
$('#welcome h1').lettering();
var intval = 7200;
function ResetFunction() {
TweenMax.killAll(true, false, true);
};
function Slide1Function() {
var Slide1 = new TimelineMax();
$('#section1').append([
Slide1.to($('.head_animation'), .2, {css:{display: 'block', opacity: '1'}}),
Slide1.to($('.head2_animation'), .2, {css:{ display: 'block', opacity: '1'}}),
Slide1.from($('.head2_animation'), 1.8, {css:{ top: '300px'}, ease:Expo.easeInOut}, -1.5),
Slide1.from($('.head_animation .char1'), .25, {css:{top: '-200px', right:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char2'), .25, {css:{top: '300px', right:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char3'), .25, {css:{top: '-400px', right:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char4'), .25, {css:{top: '-200px', left:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char5'), .25, {css:{top: '200px', left:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char6'), .25, {css:{top: '-200px', left:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char7'), .25, {css:{top: '200px', left:'1000px'}, ease:Elastic.easeOut}),
Slide1.from($('.head_animation .char1'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char2'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char3'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char4'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char5'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char6'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}}),
Slide1.from($('.head_animation .char7'), .3, {css:{color: '#4f3f35', fontFamily: 'MenschBold'}})
]);
};
$slideshow.serialScroll({
target:'#sections',
items:'li.slide',
prev: $prev,
next: $next,
axis:'xy',
navigation: $homeslidernav,
interval:intval,
duration:0,
force:true,
constant:false,
onBefore:function(e, elem, $pane, $items, pos){
$homeslidernav.removeClass('active');
$homeslidernav.removeAttr("disabled");
$homeslidernav.eq(pos).addClass('active');
$homeslidernav.eq(pos).attr("disabled", "disabled");
$('#sections li.slide').removeClass('first');
$('#sections li.slide').removeClass('current');
$('#sections li.slide').eq(pos).addClass('current');
if($('#section1.current').length > 0) {
Slide1Function();
}
else {
ResetFunction();
$('.head_animation').css({'display': 'none', 'opacity':'0'});
$('.head2_animation').css({'display': 'none', 'opacity':'0'});
};
e.preventDefault();
if(this.blur)
this.blur();
},
onAfter:function(elem){
if($('#section1.first').length > 0) {
Slide1Function();
}
}
});
});
沒有跳出我。通過註釋行和/或塊來嘗試一些很好的老式調試,以幫助查明問題的根源。 – Jrod 2013-02-22 21:30:38
你使用哪個jQuery插件?請鏈接/標記它們。另外,我認爲你實際上應該使用一些循環代碼的一部分作爲開始。 – Bergi 2013-02-22 21:33:19
看起來他正在使用[此SerialScroll插件](http://flesler.blogspot.com/2008/02/jqueryserialscroll.html)。但是沒有'cycle:true'選項,它不應該循環。 – Barmar 2013-02-22 21:37:49