Jump to content

replay problem


dgnzcn

Recommended Posts

Hi, my gallery codes working but if there a only one image it is always replay, have can i modify my codes if there are only  one image replay is off.


jQuery.fn.fadeSlideShow=function(options){return this.each(function(){settings=jQuery.extend({width:'100%', height:'100%',speed:2400,interval:1000,ListElement:'fssList',ListLi:'fssLi',ListLiActive:'fssActive',addListToId:false,allowKeyboardCtrl:true,autoplay:true},options);jQuery(this).css({width:settings.width,height:settings.height,position:'fixed',overflow:'hidden'});jQuery('> *',this).css({position:'fixed',width:settings.width,height:settings.height});Slides=jQuery('> *',this).length;Slides=Slides-1;ActSlide=Slides;jQslide=jQuery('> *',this);fssThis=this;autoplay=function(){intval=setInterval(function(){jQslide.eq(ActSlide).fadeOut(settings.speed);if(settings.ListElement){setActLi=(Slides-ActSlide)+1;if(setActLi>Slides){setActLi=0;}
jQuery('#'+settings.ListElement+' li').removeClass(settings.ListLiActive);jQuery('#'+settings.ListElement+' li').eq(setActLi).addClass(settings.ListLiActive);}
if(ActSlide<=0){jQslide.fadeIn(settings.speed);ActSlide=Slides;}else{ActSlide=ActSlide-1;}},settings.interval);if(settings.PlayPauseElement){jQuery('#'+settings.PlayPauseElement).html(settings.PauseText);}}
stopAutoplay=function(){clearInterval(intval);intval=false;if(settings.PlayPauseElement){jQuery('#'+settings.PlayPauseElement).html(settings.PlayText);}}
jumpTo=function(newIndex){if(newIndex<0){newIndex=Slides;}
else if(newIndex>Slides){newIndex=0;}
if(newIndex>=ActSlide){jQuery('> *:lt('+(newIndex+1)+')',fssThis).fadeIn(settings.speed);}else if(newIndex<=ActSlide){jQuery('> *:gt('+newIndex+')',fssThis).fadeOut(settings.speed);}
ActSlide=newIndex;if(settings.ListElement){jQuery('#'+settings.ListElement+' li').removeClass(settings.ListLiActive);jQuery('#'+settings.ListElement+' li').eq((Slides-newIndex)).addClass(settings.ListLiActive);}}
if(settings.ListElement){i=0;li='';while(i<=Slides){if(i==0){li=li+'';}else{li=li+'';}
i++;}
List='<ul id="'+settings.ListElement+'">'+li+'<\/ul>';if(settings.addListToId){jQuery('#'+settings.addListToId).append(List);}else{jQuery(this).after(List);}
jQuery('#'+settings.ListElement+' a').bind('click',function(){index=jQuery('#'+settings.ListElement+' a').index(this);stopAutoplay();ReverseIndex=Slides-index;jumpTo(ReverseIndex);return false;});}
if(settings.PlayPauseElement){if(!jQuery('#'+settings.PlayPauseElement).css('display')){jQuery(this).after('');}
if(settings.autoplay){jQuery('#'+settings.PlayPauseElement).html(settings.PauseText);}else{jQuery('#'+settings.PlayPauseElement).html(settings.PlayText);}
jQuery('#'+settings.PlayPauseElement).bind('click',function(){if(intval){stopAutoplay();}else{autoplay();}
return false;});}
if(settings.NextElement){if(!jQuery('#'+settings.NextElement).css('display')){jQuery(this).after('<a href="#" id="'+settings.NextElement+'">'+settings.NextElementText+'<\/a>');}
jQuery('#'+settings.NextElement).bind('click',function(){nextSlide=ActSlide-1;stopAutoplay();jumpTo(nextSlide);return false;});}
if(settings.PrevElement){if(!jQuery('#'+settings.PrevElement).css('display')){jQuery(this).after('<a href="#" id="'+settings.PrevElement+'">'+settings.PrevElementText+'<\/a>');}
jQuery('#'+settings.PrevElement).bind('click',function(){prevSlide=ActSlide+1;stopAutoplay();jumpTo(prevSlide);return false;});}
if(settings.allowKeyboardCtrl){jQuery(document).bind('keydown',function(e){if(e.which==39){nextSlide=ActSlide-1;stopAutoplay();jumpTo(nextSlide);}else if(e.which==37){prevSlide=ActSlide+1;stopAutoplay();jumpTo(prevSlide);}else if(e.which==32){if(intval){stopAutoplay();}
else{autoplay();}
return false;}});}
if(settings.autoplay){autoplay();}else{intval=false;}});};
Edited by dgnzcn
Link to comment
Share on other sites

I had to look up the actual library since it is nearly impossible to read minified code like that. Anyway, you can set autoplay to false in your options. You will need to define this in a condition.

var autoplay = true;

if (images.length === 1)
    autoplay = false;
Edited by doddsey_65
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.