0
我已經在jquery中創建了一個滑塊,根據點擊鏈接移動.slides-container
。這在除Firefox(20.0)以外的每個主要瀏覽器(甚至ie9)中都能很好地工作。問題似乎是Firefox忽略了.info-container
的填充,因爲當我禁用填充時,一切都很好用。如何讓jquery在進行計算時承認.info-container
的填充而不會搞亂其他瀏覽器?任何人有想法如何解決它?火狐Jquery計算錯誤
JS
var contentwidth = parseInt($('.slides-content').innerWidth(), 10);
$('.slides-container').css({'width': $('.info-container').length*contentwidth});
$('.info-container').css({'width': contentwidth});
HTML
<div class="slides-content clearfix">
<div class="slides-container">
<div class="info-container me clearfix">
<div class="info"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem, aliquam amet minus porro animi assumenda error esse sit explicabo quam quisquam ipsum nihil dignissimos. Dolorem quisquam quaerat maiores ducimus optio.</p></div>
</div>
<div class="info-container pics clearfix">
<div class="info"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti, asperiores, fugit, necessitatibus officia facere tempora ad officiis sed est architecto voluptatibus enim in. Aspernatur amet fugiat repellat incidunt placeat voluptas.</p></div>
</div>
<div class="info-container about clearfix">
<div class="info"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas, et perspiciatis quasi voluptatem maxime vero dolores iusto fugiat corporis ducimus cum at consectetur repellat culpa eius blanditiis ut? Eaque, assumenda?</p></div>
</div>
</div>
</div>
CSS
.slides-content {
overflow: hidden;
width: 100%;
}
.slides-container {
overflow: hidden;
position: relative;
}
.info-container {
padding: 35px;
position: relative;
background-color: #F8F8F8;
color: #7F7F7F;
font-size: 17px;
float: left;
line-height: 19px;
font-weight: 300;
.info {
position: relative;
float: left;
}
}
錯誤 正確
.info-container是796,.info是726 – 2013-04-24 21:06:23