var myLeft;?? ? ? ?rePoint();? ? function rePoint() {?? ? ? ? var myLeftNumber = parseInt((document.body.clientWidth - 1100) / 2);?? ? ? ? if (myLeftNumber < 0) {?? ? ? ? ? ? myLeftNumber = 0;?? ? ? ? }? ? ? ? if (myLeft == myLeftNumber) {?? ? ? ? ? ? return;?? ? ? ? }? ? ? ? myLeft = myLeftNumber;?? ? }? hidden.css({width:"1100px",height:"375px",top:"0","left":"0px","opacity":0,}); hidden.stop(true,true).animate({width:"1100px",height:"375px",top:"0",left:"0px",opacity:1,},timer); curr.stop(true,true).animate({width:"1100px",height:"375px",top:"0","left":"50%",opacity:1,},timer); next.stop(true,true).animate({width:"1100px",height:"375px",top:"0","left":"0px","opacity":0,},timer,function(){next.find("span").css("opacity",0); isMoving = false;}); //prev ?--> ?curr ? ? prev中的圖片li輪換到curr的位置 ? ? ?其他一次輪換 prev.find("span").css("opacity",0); $(".main_banner_box li").find("p").css({"bottom":"-50px"});//所有標(biāo)題隱藏 prev.stop(true,true).animate({width:"1100px",height:"375px",left:"myLeft",top:0,opacity:1},timer,function(){ $(this).find("p").animate({"bottom":"0px"}); //當(dāng)前這張圖片的標(biāo)題運(yùn)動(dòng)出來(lái) }); index_2--; }else{ //執(zhí)行next 操作 if(index_2+2>=len){ //index_2 3 4 hidden=$("#imgCard"+(index_2+2-len));// 0 1 }else{ //index_2 0 1 2 hidden=$("#imgCard"+(index_2+2));// 2 3 4 } prev.css("z-index","1"); next.css("z-index","5"); //點(diǎn)擊next按鈕 ?讓next位置上的這張圖片 層級(jí)最高 顯示 curr.css("z-index","2"); hidden.css("z-index","1"); //當(dāng)index_2自增,各圖片往左運(yùn)動(dòng)效果 hidden.css({width:"1100px",height:"375px",top:"0px","left":"50%","opacity":0}); hidden.stop(true,true).animate({width:"1100px",height:"375px",top:"0px",opacity:1},timer); curr.stop(true,true).animate({width:"1100px",height:"375px",top:"0px",left:"0px",opacity:1},timer); //next ?--> ?curr ? ? next中的圖片li輪換到curr的位置 ? ? ?其他一次輪換 next.find("span").css("opacity",0); $(".main_banner_box li").find("p").css({"bottom":"-50px"});//所有標(biāo)題隱藏 next.stop(true,true).animate({width:"1100px",height:"375px",left:"myLeft",top:0,opacity:1,margin:"0 auto"},timer,function(){ $(this).find("p").animate({"bottom":"0px"}); //當(dāng)前這張圖片的標(biāo)題運(yùn)動(dòng)出來(lái) }); prev.stop(true,true).animate({width:"1100px",height:"375px",left:"0px",top:"0px",opacity:0},timer,function(){ isMoving = false; });? index_2++; }
left的值在網(wǎng)頁(yè)里總是不對(duì),用的別人的模板
qq_明王爺_0
2017-08-07 16:06:53