function boxmove(target, time){ var set=null; var type=1; var lis = target.find('li'); var ul = target.find('ul'); var liHeight =lis.eq(0).height(); var pageHeight = Math.ceil((liHeight*(lis.length/4))-(liHeight*3)); var move = function(){ var top = ul.position().top; if (type==1 && top>=-pageHeight){ top-=1; ul.css('top', top); }else if (type==0&&top<=0){ top+=1; ul.css('top', top); }else if(top == -(pageHeight+1)){ top=1; ul.css('top', top); }else if(top == 1){ top = -(pageHeight+1); ul.css('top', top); } set = setTimeout(function () { move() }, time); } /*target.bind('mousemove',function(e){ var center = target.Width()/2; var offset = target.offset().left; //center=offset+center; if (e.clientY < center){ //$('#test').text('left') if (type!=1){ clearTimeout(set); type=1; move(); } }else{ //$('#test').text('right') if (type!=0){ clearTimeout(set); type=0; move(); } } });*///.bind('mouseout',function(){ //clearTimeout(set); //type=-1; //}); //鼠标移就停止 //按钮点击事件 target.bind('mouseout',function(){ move(); }).bind('mouseover',function(){ clearTimeout(set); }); /*$('.m-pro .u-prev').click(function(){ if (type!=1){ clearTimeout(set); type=1; left=1; move(); } }); $('.m-pro .u-next').click(function(){ if (type!=0){ clearTimeout(set); type=0; left=0; move(); } });*/ move(); }