/*
$('#slideshow2').slideshows( { showcaption: false,//true showpreview: false,//true showpaging:false//true } ); */ (function($) { $.fn.slideshows = function(options){ var object=null; var timer=null; var index=0; var slides=[]; var playing=false; var lastslide=null; if (!this.length) { return; } options = $.extend({ showcaption: true, showpreview: true, showpaging: true }, options || {}); object = this; slides = object.find('.slide'); if(options.showpaging==true){ object.append('
'); object.children().eq(1).html(""); var de; for(i=0;i'+ eval(i+1) +''); } if(options.showpreview==true){ object.find('.paging a').mouseleave(function() { object.find('.preview').empty().hide(); }); } object.find('.paging a').each(function(i) { $(this).click(function() { jump(i, $(this)); }) if(options.showpreview==true){ $(this).mouseover(function() { preview(i); }); } }); } if(options.showpreview==true){ object.append('
'); } if(options.showcaption==true){ object.append('
'); } object.find('.mask').hover( function() { pause(); }, function() { play(); } ); if (slides.length <= 1){ object.find('.paging').hide(); } play(); function fade(index) { slides.stop(true, true).fadeout('normal'); slides.eq(index).fadein(1500); if(options.showcaption==true){ var caption = object.find('.caption'); caption.stop(true, true).fadeout('fast', function() { if ($(slides[index]).attr("caption")) { caption.html("") .append('

'+ $(slides[index]).attr("caption") +'

') .append($(slides[index]).attr("desc")) .fadein(1500); } }); } if(options.showpaging==true){ object .find('.paging a').removeclass('current').end() .find('.paging a:eq('+ index +')').addclass('current'); } lastslide = index; } function jump(index, control) { if ((lastslide == index) || (slides.length <= 1)){ return; } pause(); fade(index); index = index; play(); } function play() { if (slides.length <= 1){ return; } if (!playing) { playing = true; timer = window.setinterval(rotate, 4000); } } function pause() { if (slides.length <= 1){ return; } window.clearinterval(timer); playing = false; } function preview(index) { var tooltip = object.find('.preview'), top = (index * 15) + 15; if ($(slides[index]).find('img').attr("src")) { $('', { src: $(slides[index]).find('img').attr("src"), width: 100, height: 47, alt: '' }).appendto(tooltip); } tooltip.append(''+ $(slides[index]).attr("caption") +'').css('top', top); tooltip.show(); } function rotate() { var slideindex = index + 1; if (slideindex > (slides.length - 1)){ slideindex = 0; } if (lastslide == slideindex){ return; } fade(slideindex); index = slideindex; } }; })(jquery);