/* * requires:jQuery v1.7.1 later * name:jquery.SimpleSlide.js * author:Manabu Kushimoto(web-park.org) */ jQuery(function($){ $.fn.extend({ //メイン画像スライド切り替え mainSlide:function(options){ var defaults={ width:800, speed:300, interval:1000, on_class:"on" }; var op=$.extend(defaults,options); var $t=$(this); var $target=$t.children(); var len=$target.length; var con_len=len; var nav_num=0; var index=0; var past_index=0; var automove=""; for(var m=0;m<(len*2);m++){ $t.children().eq(m).clone(true).appendTo($t); } len=len*3; var center=Math.floor(len/2); for(var l=0;l=(con_len-1)){ past_index=0; }else{ past_index=past_index+1; } } }else if(direct=="-"){ var num=center-1; } $t.children().eq(num).find("img").not($t.children().eq(num)+":animated").animate({ opacity:1 },op.speed,"swing"); $t.not($t+":animated").animate({ left:-(op.width*num)+"px" },op.speed,"swing",function(){ if(direct=="+") $(this).children().eq(0).appendTo($(this)); if(direct=="-") $(this).children().eq((len-1)).prependTo($(this)); $(this).css({left:-(op.width*center)+"px"}); }); }; //prevをクリック $("div#slide_area").find("a[href='#prev']").click(function(){ slideMove("-"); clearInterval(automove); autoFN(); return false; }); //nextをクリック $("div#slide_area").find("a[href='#next']").click(function(){ slideMove("+"); clearInterval(automove); autoFN(); return false; }); //自動ループ function autoFN(){ automove=setInterval(function(){ slideMove("+"); },op.interval,"swing"); } autoFN(); } }); $("div#slide_area div.move").mainSlide({ width:710, speed:1000, interval:10000, on_class:"active" }); });