0

我在 jquery 中创建了一个滑块,它.slides-container根据单击的链接移动。这在除 Firefox(20.0) 之外的所有主流浏览器(甚至 ie9)中都能很好地工作。问题似乎是 Firefox 忽略了填充,.info-container因为当我禁用填充时,一切正常。如何告诉 jquery.info-container在进行计算时确认填充而不弄乱其他浏览器?任何人都知道如何解决它?

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;
    }
}

错误 在此处输入图像描述 更正 在此处输入图像描述

4

1 回答 1

0

检查 info 和 info-container 的内部宽度是否相同。

于 2013-04-24T21:02:47.273 回答