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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

瀑布流為什么在ie上正常顯示,chrome有時(shí)會(huì)重疊,有時(shí)又正常?

瀑布流為什么在ie上正常顯示,chrome有時(shí)會(huì)重疊,有時(shí)又正常?

<!DOCTYPE html><html><head><meta charset="UTF-8"><title>瀑布流</title><style type="text/css">? ? *{? ? ?padding: 0;? ? ?margin: 0;? ? }#main{position: relative;}.box{padding: 15px 0 0 15px;float: left;}.img{padding: 10px;border: 1px solid gray;border-radius: 10px;?box-shadow: 0px 0px 5px #ccc;}.img img{width: 120px;height: auto;}</style></head><body><div id="main"><div class="box"><div class="img"><img src="img/1.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/2.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/3.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/4.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/5.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/6.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/7.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/8.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/9.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/10.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/11.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/12.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/13.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/14.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/15.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/16.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/17.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/18.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/19.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/20.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/21.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/22.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/23.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/24.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/25.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/26.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/27.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/28.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/29.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/30.jpg" alt=""></div></div><div class="box"><div class="img"><img src="img/31.jpg" alt=""></div></div></div><script type="text/javascript">var wrap=document.getElementById('main');var boxImg=document.getElementsByClassName('box');? ? ? ? var dataInt={? ? ? ? ?"data":[{"src":"1.jpg"},{"src":"2.jpg"},{"src":"3.jpg"},{"src":"4.jpg"},{"src":"5.jpg"},{"src":"6.jpg"},{"src":"7.jpg"},{"src":"8.jpg"}]? ? ? ? };//滑動(dòng)鼠標(biāo)加載window.onscroll=function(){if (isScrollSlider()) {? ? ? ? ? ? ? ?for (var i = dataInt.data.length - 1; i >= 0; i--) {? ? ? ? ? ? ? ? ?var boxImg=document.createElement('div');? ? ? ? ? ? ? ? ?boxImg.className='box';? ? ? ? ? ? ? ? ?wrap.appendChild(boxImg);? ? ? ? ? ? ? ? ?boxImg.innerHTML='<div class="img"><img src="img/'+dataInt.data[i]['src']+'" alt=""></div>';? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? waterfull();}else{? ? ? ? ? ? ? ?return}isScrollSlider();};function isScrollSlider(){var lastImgBox=boxImg[boxImg.length-1];var latBoxH=lastImgBox.offsetTop+lastImgBox.offsetHeight;//最后一個(gè)圖片中間距頂點(diǎn)位置var scrollHeight=document.documentElement.scrollTop+document.documentElement.clientHeight;return latBoxH-scrollHeight;};function waterfull(){//圖片盒子的寬度var boxImgWidth=boxImg[0].offsetWidth;//網(wǎng)頁(yè)寬度var clientWdith=document.documentElement.clientWidth;//圖片列數(shù)var imgCol=Math.floor(clientWdith/boxImgWidth);wrap.style.width=boxImgWidth*imgCol+'px';wrap.style.margin='0 auto';//存放每一列的高度var hArr=[];for (let i = 0; i < boxImg.length; i++) {if (i<imgCol) {hArr.push(boxImg[i].offsetHeight);}else{? ? ? ? //找出高度最低的box;? ? ? ? var minH=Math.min.apply(null,hArr);? ? ? ? var index=getMinIndex(minH,hArr);? ? ? ? boxImg[i].style.position='absolute';? ? ? ? boxImg[i].style.left=index*boxImgWidth+'px';? ? ? ? boxImg[i].style.top=minH+'px';? ? ? ? hArr[index]+=boxImg[i].offsetHeight;? ? ? ? }}? ? ? ? function getMinIndex(value,arr) {? ? ? ? ?for (let i = arr.length - 1; i >= 0; i--) {? ? ? ? ?if (arr[i]==value) {? ? ? ? ?return i;? ? ? ? ?}? ? ? ? ?}? ? ? ? }};waterfull();</script></body></html>
查看完整描述

1 回答

?
pardon110

TA貢獻(xiàn)1038條經(jīng)驗(yàn) 獲得超227個(gè)贊

你寫的代碼兼容性差,不同瀏覽器廠商對(duì)同一份代碼會(huì)有差異。

查看完整回答
反對(duì) 回復(fù) 2018-11-17
  • 1 回答
  • 0 關(guān)注
  • 1076 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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