第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

預(yù)加載頁(yè)無(wú)效

為什么我的加載頁(yè)沒(méi)效果,直接重0就跳過(guò)去了,調(diào)試看數(shù)組也遍歷過(guò)了,就是沒(méi)執(zhí)行觸發(fā)load事件后的代碼

<!DOCTYPE?html>
<html>
<head>
????<meta?charset="UTF-8">
????<title>圖片預(yù)加載之無(wú)序加載</title>
????<script?src="../js/jquery.min.1.7.js"></script>

????<style>

????????html,body{
????????????height:?100%;
????????}

????????.box{
????????????text-align:?center;
????????}

????????.btn,.btn:link{

????????????display:?inline-block;
????????????text-decoration:?none;
????????????height:?30px;
????????????line-height:?30px;
????????????border:?1px?#cccccc?solid;
????????????background:?#ffffff;
????????????padding:?0px?10px;
????????????margin-right:?50px;
????????????color:?#333333;

????????}
????????.btn:hover{
????????????background:?#dddddd;
????????}
????????.loading{
????????????position:?fixed;
????????????top:0;
????????????left:?0px;
????????????width:?100%;
????????????height:?100%;
????????????background:?#eeeeee;
????????????text-align:?center;
????????????font-size:?30px;

????????}
????????.progress{
????????????margin-top:?300px;
????????}

????</style>

</head>
<body>


????<div>
????????<p>0</p>

????</div>

????<div>

????????<img?id="img"?src="../imgs/1.jpg"?alt="pic"?height="800"?width="960"/>

????????<p>
????????????<a?href="#"?data-control="prev">上一頁(yè)</a>
????????????<a?href="#"?data-control="next">下一頁(yè)</a>
????????</p>


????</div>
????<script>

????????var?imgs?=?['../imgs/1.jpg','../imgs/2.jpg','../imgs/3.jpg','../imgs/4.jpg','../imgs/5.jpg'];

????????var?now?=?0;
????????var?len?=?imgs.length;
????????var?count?=?0;
????????$progress?=?$('.progress');

????????$('.btn').on('click',function?()?{
????????????if($(this).data('control')?==='prev'){

????????????????/*now先自減1再和0比較?若小于0則賦給now*/
???????????????now?=?Math.max(0,--now);
????????????}else?if($(this).data('control')?==='next'){
????????????????now?=?Math.min(len-1,++now);
????????????}
????????????document.title?=?(now+1)+"/"+len
????????????$('#img').attr('src',imgs[now]);

????????});


????????$.each(imgs,function?(i,src)?{

????????????/*圖片加載完會(huì)觸發(fā)load事件,出錯(cuò)觸發(fā)error事件*/
????????????var?imgObj?=?new?Image();

????????????/*綁定load事件*/
????????????$(imgObj).on('load',function?()?{



????????????????$progress.html(Math.round(count+1/len?*?100)+'%');

????????????????if(count>=len-1){
????????????????????$('.loading').hide();
????????????????????document.title='1/'+len;
????????????????}
????????????????count++;

????????????});

????????????imgObj.src?=?src;
????????});

????</script>

</body>
</html>


正在回答

2 回答

$('#img').attr('src',imgs[now]);和imgObj.src?=?src; ? 前者是從數(shù)組中獲取圖片的路徑,后者又是干什么啦……

0 回復(fù) 有任何疑惑可以回復(fù)我~

問(wèn)題差不多想清楚了,我的圖片太大,有的瀏覽器不顯示,有的從緩存拿還需要一段時(shí)間

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

預(yù)加載頁(yè)無(wú)效

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)