Browse Source

adds waitTime variable

rewrite
Viljami S 13 years ago
parent
commit
6239d8e7f6
  1. 11
      responsiveslides.js
  2. 10
      responsiveslides.min.js

11
responsiveslides.js

@ -45,7 +45,8 @@
index = 0,
$slide = $this.children(),
length = $slide.size(),
fadetime = parseFloat(settings.speed),
fadeTime = parseFloat(settings.speed),
waitTime = parseFloat(settings.timeout),
maxw = parseFloat(settings.maxwidth),
// Namespacing
@ -70,13 +71,13 @@
$this.trigger(namespace + "-before");
$slide
.stop()
.fadeOut(fadetime, function () {
.fadeOut(fadeTime, function () {
$(this)
.removeClass(visibleClass)
.css(hidden);
})
.eq(idx)
.fadeIn(fadetime, function () {
.fadeIn(fadeTime, function () {
$(this)
.addClass(visibleClass)
.css(visible)
@ -118,7 +119,7 @@
if ($slide.size() > 1) {
// Make sure the timeout is at least 100ms longer than the fade
if (settings.timeout < settings.speed + 100) {
if (waitTime < fadeTime + 100) {
return;
}
@ -166,7 +167,7 @@
}
slideTo(idx);
}, parseFloat(settings.timeout));
}, waitTime);
};
// Init cycle

10
responsiveslides.min.js vendored

@ -1,6 +1,6 @@
/*! http://responsiveslides.com v1.3 by @viljamis */
(function(d,C,v){d.fn.responsiveSlides=function(i){var b=d.extend({auto:!0,speed:1E3,timeout:4E3,pager:!1,nav:!1,random:!1,pause:!1,pauseControls:!1,prevText:"Previous",nextText:"Next",maxwidth:"",controls:"",namespace:"rslides"},i);return this.each(function(){v++;var c=d(this),o,q,j,l,m,n=0,e=c.children(),w=e.size(),x=parseFloat(b.speed),r=parseFloat(b.maxwidth),g=b.namespace,h=g+v,f=g+"_nav "+h+"_nav",s=g+"_here",k=h+"_on",y=h+"_s",p=d("<ul class='"+g+"_tabs "+h+"_tabs' />"),z={"float":"left",position:"relative"},
D={"float":"none",position:"absolute"},t=function(a){c.trigger(g+"-before");e.stop().fadeOut(x,function(){d(this).removeClass(k).css(D)}).eq(a).fadeIn(x,function(){d(this).addClass(k).css(z).trigger(g+"-after");n=a})};b.random&&(e.sort(function(){return Math.round(Math.random())-0.5}),c.empty().append(e));e.each(function(a){this.id=y+a});c.addClass(g+" "+h);i&&i.maxwidth&&c.css("max-width",r);e.hide().eq(0).addClass(k).css(z).show();if(1<e.size()){if(b.timeout<b.speed+100)return;if(b.pager){var u=
[];e.each(function(a){a=a+1;u=u+("<li><a href='#' class='"+y+a+"'>"+a+"</a></li>")});p.append(u);m=p.find("a");i.controls?d(b.controls).append(p):c.after(p);o=function(a){m.closest("li").removeClass(s).eq(a).addClass(s)}}b.auto&&(q=function(){l=setInterval(function(){var a=n+1<w?n+1:0;b.pager&&o(a);t(a)},parseFloat(b.timeout))},q());j=function(){if(b.auto){clearInterval(l);q()}};b.pause&&c.hover(function(){clearInterval(l)},function(){j()});b.pager&&(m.bind("click",function(a){a.preventDefault();
b.pauseControls||j();a=m.index(this);if(!(n===a||d("."+k+":animated").length)){o(a);t(a)}}).eq(0).closest("li").addClass(s),b.pauseControls&&m.hover(function(){clearInterval(l)},function(){j()}));if(b.nav){f="<a href='#' class='"+f+" prev'>"+b.prevText+"</a><a href='#' class='"+f+" next'>"+b.nextText+"</a>";i.controls?d(b.controls).append(f):c.after(f);var f=d("."+h+"_nav"),A=d("."+h+"_nav.prev");f.bind("click",function(a){a.preventDefault();if(!d("."+k+":animated").length){var c=e.index(d("."+k)),
a=c-1,c=c+1<w?n+1:0;t(d(this)[0]===A[0]?a:c);b.pager&&o(d(this)[0]===A[0]?a:c);b.pauseControls||j()}});b.pauseControls&&f.hover(function(){clearInterval(l)},function(){j()})}}if("undefined"===typeof document.body.style.maxWidth&&i.maxwidth){var B=function(){c.css("width","100%");c.width()>r&&c.css("width",r)};B();d(C).bind("resize",function(){B()})}})}})(jQuery,this,0);
(function(d,D,w){d.fn.responsiveSlides=function(i){var b=d.extend({auto:!0,speed:1E3,timeout:4E3,pager:!1,nav:!1,random:!1,pause:!1,pauseControls:!1,prevText:"Previous",nextText:"Next",maxwidth:"",controls:"",namespace:"rslides"},i);return this.each(function(){w++;var c=d(this),o,q,j,l,m,n=0,e=c.children(),x=e.size(),r=parseFloat(b.speed),y=parseFloat(b.timeout),s=parseFloat(b.maxwidth),g=b.namespace,h=g+w,f=g+"_nav "+h+"_nav",t=g+"_here",k=h+"_on",z=h+"_s",p=d("<ul class='"+g+"_tabs "+h+"_tabs' />"),
A={"float":"left",position:"relative"},E={"float":"none",position:"absolute"},u=function(a){c.trigger(g+"-before");e.stop().fadeOut(r,function(){d(this).removeClass(k).css(E)}).eq(a).fadeIn(r,function(){d(this).addClass(k).css(A).trigger(g+"-after");n=a})};b.random&&(e.sort(function(){return Math.round(Math.random())-0.5}),c.empty().append(e));e.each(function(a){this.id=z+a});c.addClass(g+" "+h);i&&i.maxwidth&&c.css("max-width",s);e.hide().eq(0).addClass(k).css(A).show();if(1<e.size()){if(y<r+100)return;
if(b.pager){var v=[];e.each(function(a){a=a+1;v=v+("<li><a href='#' class='"+z+a+"'>"+a+"</a></li>")});p.append(v);m=p.find("a");i.controls?d(b.controls).append(p):c.after(p);o=function(a){m.closest("li").removeClass(t).eq(a).addClass(t)}}b.auto&&(q=function(){l=setInterval(function(){var a=n+1<x?n+1:0;b.pager&&o(a);u(a)},y)},q());j=function(){if(b.auto){clearInterval(l);q()}};b.pause&&c.hover(function(){clearInterval(l)},function(){j()});b.pager&&(m.bind("click",function(a){a.preventDefault();b.pauseControls||
j();a=m.index(this);if(!(n===a||d("."+k+":animated").length)){o(a);u(a)}}).eq(0).closest("li").addClass(t),b.pauseControls&&m.hover(function(){clearInterval(l)},function(){j()}));if(b.nav){f="<a href='#' class='"+f+" prev'>"+b.prevText+"</a><a href='#' class='"+f+" next'>"+b.nextText+"</a>";i.controls?d(b.controls).append(f):c.after(f);var f=d("."+h+"_nav"),B=d("."+h+"_nav.prev");f.bind("click",function(a){a.preventDefault();if(!d("."+k+":animated").length){var c=e.index(d("."+k)),a=c-1,c=c+1<x?n+
1:0;u(d(this)[0]===B[0]?a:c);b.pager&&o(d(this)[0]===B[0]?a:c);b.pauseControls||j()}});b.pauseControls&&f.hover(function(){clearInterval(l)},function(){j()})}}if("undefined"===typeof document.body.style.maxWidth&&i.maxwidth){var C=function(){c.css("width","100%");c.width()>s&&c.css("width",s)};C();d(D).bind("resize",function(){C()})}})}})(jQuery,this,0);
Loading…
Cancel
Save