为什么这里的offsetLeft和style.left不一样????
* { 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);}
1 2 3 4 5
< >
|
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
offsetLeft是要算所有(本身和父元素)的边框,#container有个border:4px,所以计算#imgList的offsetLeft的时候会加上这4px |
|
|
|
|