myfocus.pattern.extend({//*********************奇艺****************** 'mf_qiyi':function(settings,$){ (function($$) { $$(function() { var $focus=$(settings); var $slider=$focus.addhtml('
'); $slider[0].appendchild($focus.find('.pic')[0]); $slider[0].appendchild($focus.addlisttxt()[0]); var $piclist=$focus.find('.pic li'); var $txtlist=$focus.find('.txt li'); var $numlist=$focus.addlistnum().find('li'); //var $btn = $focus.addhtml('
'); //css var w=settings.width,txth=settings.txtheight,n=$piclist.length,bodyw=$$(window).width(),_len=$piclist.length; function autow(){ //bodyw=$$(window).width(); bodyw=275; $slider[0].style.width=bodyw*n+'px'; $focus[0].style.width=bodyw+'px'; for(var i=0;ibodyw){ var _left = -(picw - bodyw)/2; $$(dom).css({"left":_left}) }else{ $$(dom).css({"left":0}) } }) } autow() $$(window).resize(function(){ autow(); $slider[0].style.left=-bodyw*$focus.runindex+"px"; }) //play $focus.play(function(i){ $numlist[i].classname=''; $piclist[i].classname=''; },function(i){ $txtlist[i].style.top=0+'px';//复位 $slider.slide({left:-bodyw*i},800,function(){ $txtlist.eq(i).slide({top:-txth}); }); $numlist[i].classname='current'; }); //control $focus.bindcontrol($numlist); //$btn.find(".prev").bind('click',function(){$focus.run('-=1')}); //$btn.find(".next").bind('click',function(){$focus.run('+=1')}); /*$$($focus).hover(function(){ $$($btn).fadein(400) },function(){ $$($btn).fadeout(400) })*/ }); })(jquery); } }); myfocus.config.extend({'mf_qiyi':{txtheight:34}});//默认文字层高度