2

ページを埋めるために幅を100%に設定したanysliderを使用していますが、ページがスクロールバーを使用している場合を除いて正常に動作し、スライダーは100%+スクロールバーの幅です。これを修正するためにできることはありますか?

4

2 に答える 2

1

スライダーの幅を100%に設定する代わりに。親を100%に設定し(高さも設定)、expandオプションをtruedemo)に設定します。

HTML

<div id="wrapper">
    <ul id="slider">
        <li><img src="http://placekitten.com/300/200" alt="" /></li>
        <li><img src="http://placehold.it/300x200" alt="" /></li>
        <li><img src="http://ipsumimage.appspot.com/300x200.png" alt="" /></li>
        <li><img src="http://dummyimage.com/300x200/000/fff.jpg" alt="" /></li>
    </ul>
</div>

CSS

#wrapper {
    height: 500px;
}

脚本

$('#slider').anythingSlider({
    // If true, the entire slider will expand to fit the parent element
    expand: true
});​
于 2012-04-25T02:29:00.090 に答える
1

これを試して:

 var width = document.body.clientWidth; // this is the inner or viewport dimension that excludes scrollbars 
 $("#slider").width(width);
于 2012-04-24T11:48:56.607 に答える