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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么這里的offsetLeft和style.left不一樣????

為什么這里的offsetLeft和style.left不一樣????

上帝子民Chris 2016-10-02 21:29:34
<html> <head> <style?type='text/css'> *?{?margin:?0px;?padding:?0px;?text-decoration:?none;} #container?{??overflow:?hidden;?margin:?50px?auto;?width:?550px;?height:?321px;?border:?4px?solid?#ccc;?position:?relative;} #imgList?{?position:?absolute;?width:?800%;?height:?100%;} #imgList?img?{?float:?left;} #buttonList?{?position:?absolute;?margin:?auto;??right:?0;?left:?0;?bottom:?30px;?height:?10px;?width:?125px;} #buttonList?span?{?margin:?0?4px;?height:?15px;?width:?15px;?float:?left;?text-indent:?-9999px;?cursor:?pointer;?border:?1px?solid?#fff;?border-radius:?50%;?background-color:?#333;} .arrow?{?position:?absolute;?display:?none;?z-index:?10;?top:?180px;?line-height:?39px;?font-size:?39px;?font-weight:?bold;?width:?40px;?height:?39px;?text-align:?center;?background-color:?RGBA(0,0,0,.3);?color:?#fff;} #prev?{?left:?10px;} #next?{?right:?10px;} #container:hover?.arrow?{?display:?block;} .arrow:hover?{?background-color:?RGBA(0,0,0,.7);} </style> </head> <body> <div?id='container'> <div?id='imgList'?style='left:?-550px;'> <img?src='images/ads/5.jpg'?alt=""?/> <img?src='images/ads/1.jpg'?alt=""?/> <img?src='images/ads/2.jpg'?alt=""?/> <img?src='images/ads/3.jpg'?alt=""?/> <img?src='images/ads/4.jpg'?alt=""?/> <img?src='images/ads/5.jpg'?alt=""?/> <img?src='images/ads/1.jpg'?alt=""?/> </div> <div?id='buttonList'> <span>1</span> <span>2</span> <span>3</span> <span>4</span> <span>5</span> </div> <a?href='javascript:void(0)'?id='prev'?class='arrow'>&lt;</a> <a?href="javascript:void(0)"?id="next"?class="arrow">&gt;</a> </div> </body> <script?type='text/javascript'> function?$id(id){?return?document.getElementById(id);}; var?container?=?$id('container'); var?imgList?=?$id('imgList'); var?perv?=?$id('prev'); var?next?=?$id('next'); alert(imgList.style.left); alert(imgList.offsetLeft); </script> </html>
查看完整描述

1 回答

?
stone310

TA貢獻(xiàn)361條經(jīng)驗(yàn) 獲得超191個贊

offsetLeft是要算所有(本身和父元素)的邊框,#container有個border:4px,所以計算#imgList的offsetLeft的時候會加上這4px

查看完整回答
反對 回復(fù) 2016-10-03
  • 1 回答
  • 0 關(guān)注
  • 2131 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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