;(function($){ $.fn.junplugs=function(iset){ var self=this; iset=$.extend({type:'mouseover',select:'img',cur:0,interval:300},iset||{}); var item,animatew;//初始化变量 $(self).each(function(){ item=$(this).find(iset.select); //初始化元素排列并为元素data一个索引值 item.each(function(i){ $(this).data('index',i); }).on(iset.type,function(e){//绑定鼠标事件 //获取当前元素索引值 sindex=$(this).data('index'); item.each(function(n){ n == sindex ? animatew=540 : animatew=218; $(this).stop(true,false).animate({'width':animatew},iset.interval,function(){ if(n == sindex){ $(this).find(".g-img").fadein(100); $(this).find("h2").addclass("on"); $(this).find(".forcutwords").width(350); $(this).find(".v_a").width(280); }else{ $(this).find(".g-img").fadeout(100); $(this).find("h2").removeclass("on"); $(this).find(".forcutwords").width(183); $(this).find(".v_a").width(166); } }); }); }).eq(iset.cur).trigger(iset.type); }); } })(jquery);