2014-09-30 52 views
1

水平滾動我使用模板與引導3並喜歡使用bxSlider(http://bxslider.com/examples/thumbnail-pager-1)插入頁面。我想讓滑塊全寬(去掉div'容器'類),但是,當我應用它時會出現水平滾動條。請看看我的CSS如何防止這個小毛刺,附上截圖。bxSlider全寬避免第

enter image description here

HTML:

<!-- Fixed Height Image Aside --> 
<!-- Image backgrounds are set within the full-width-pics.css file. --> 
<aside class="image-bg-fixed-height2"> 
    <!--<div class="container">--> 
    <div class=""> 
     <div class="row"> 
      <ul class="bxslider"> 
       <li><img src="<?php echo baseurl ?>/images/pic1.jpg" /></li> 
       <li><img src="<?php echo baseurl ?>/images/pic2.jpg" /></li> 
       <li><img src="<?php echo baseurl ?>/images/pic3.jpg" /></li> 
       <li><img src="<?php echo baseurl ?>/images/pic4.jpg" /></li> 
      </ul> 

      <div id="bx-pager" class="bx-pager"> 
       <a data-slide-index="0" href=""><img src="<?php echo baseurl ?>/images/thumb/pic1.jpg" /></a> 
       <a data-slide-index="1" href=""><img src="<?php echo baseurl ?>/images/thumb/pic2.jpg" /></a> 
       <a data-slide-index="2" href=""><img src="<?php echo baseurl ?>/images/thumb/pic3.jpg" /></a> 
       <a data-slide-index="2" href=""><img src="<?php echo baseurl ?>/images/thumb/pic4.jpg" /></a> 
      </div> 
     </div> 
     <!-- /.row --> 
    </div> 
    <!-- /.container --> 
</aside> 

CSS:

.bx-wrapper { 
    background-color: #000; 
    position: relative; 
    /*margin: 0 auto 60px;*/ 
    margin: 0 auto 0px; 
    padding: 0; 
    *zoom: 1; 
} 

.bx-wrapper img { 
    max-width: 100%; 
    display: block; 
} 

/** THEME 
===================================*/ 

.bx-wrapper .bx-viewport { 
    /*-moz-box-shadow: 0 0 5px #ccc; 
    -webkit-box-shadow: 0 0 5px #ccc; 
    box-shadow: 0 0 5px #ccc; 
    border: 5px solid #fff; 
    left: -5px;*/ 
    left: 0; 
    background: #353535; 

    /*fix other elements on the page moving (on Chrome)*/ 
    -webkit-transform: translatez(0); 
    -moz-transform: translatez(0); 
     -ms-transform: translatez(0); 
     -o-transform: translatez(0); 
     transform: translatez(0); 
} 

.bx-wrapper .bx-pager, 
.bx-wrapper .bx-controls-auto { 
    position: absolute; 
    bottom: -30px; 
    width: 100%; 
    overflow-x: hidden; 
} 

/* LOADER */ 

.bx-wrapper .bx-loading { 
    min-height: 50px; 
    background: url(../images/bx_loader.gif) center center no-repeat #fff; 
    height: 100%; 
    width: 100%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    z-index: 2000; 
} 

/* PAGER */ 

.bx-wrapper .bx-pager { 
    text-align: center; 
    font-size: .85em; 
    font-family: Arial; 
    font-weight: bold; 
    color: #666; 
    padding-top: 20px; 
    background-color:#000;margin:0;padding:20px; 
} 

.bx-wrapper .bx-pager .bx-pager-item, 
.bx-wrapper .bx-controls-auto .bx-controls-auto-item { 
    display: inline-block; 
    *zoom: 1; 
    *display: inline; 
} 

.bx-wrapper .bx-pager.bx-default-pager a { 
    background: #666; 
    text-indent: -9999px; 
    display: block; 
    width: 10px; 
    height: 10px; 
    margin: 0 5px; 
    outline: 0; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    border-radius: 5px; 
} 

.bx-wrapper .bx-pager.bx-default-pager a:hover, 
.bx-wrapper .bx-pager.bx-default-pager a.active { 
    background: #000; 
} 

/* DIRECTION CONTROLS (NEXT/PREV) */ 

.bx-wrapper .bx-prev { 
    left: 25px; 
    background: url(../images/controls.png) no-repeat 0 -32px; 
} 

.bx-wrapper .bx-next { 
    right: 25px; 
    background: url(../images/controls.png) no-repeat -43px -32px; 
} 

.bx-wrapper .bx-prev:hover { 
    background-position: 0 0; 
} 

.bx-wrapper .bx-next:hover { 
    background-position: -43px 0; 
} 

.bx-wrapper .bx-controls-direction a { 
    position: absolute; 
    top: 50%; 
    margin-top: -16px; 
    outline: 0; 
    width: 32px; 
    height: 32px; 
    text-indent: -9999px; 
    z-index: 99; 
} 

.bx-wrapper .bx-controls-direction a.disabled { 
    display: none; 
} 

/* AUTO CONTROLS (START/STOP) */ 

.bx-wrapper .bx-controls-auto { 
    text-align: center; 
} 

.bx-wrapper .bx-controls-auto .bx-start { 
    display: block; 
    text-indent: -9999px; 
    width: 10px; 
    height: 11px; 
    outline: 0; 
    background: url(../images/controls.png) -86px -11px no-repeat; 
    margin: 0 3px; 
} 

.bx-wrapper .bx-controls-auto .bx-start:hover, 
.bx-wrapper .bx-controls-auto .bx-start.active { 
    background-position: -86px 0; 
} 

.bx-wrapper .bx-controls-auto .bx-stop { 
    display: block; 
    text-indent: -9999px; 
    width: 9px; 
    height: 11px; 
    outline: 0; 
    background: url(../images/controls.png) -86px -44px no-repeat; 
    margin: 0 3px; 
} 

.bx-wrapper .bx-controls-auto .bx-stop:hover, 
.bx-wrapper .bx-controls-auto .bx-stop.active { 
    background-position: -86px -33px; 
} 

/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */ 

.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager { 
    text-align: left; 
    width: 80%; 
} 

.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto { 
    right: 0; 
    width: 35px; 
} 

/* IMAGE CAPTIONS */ 

.bx-wrapper .bx-caption { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    background: #666\9; 
    background: rgba(80, 80, 80, 0.75); 
    width: 100%; 
} 

.bx-wrapper .bx-caption span { 
    color: #fff; 
    font-family: Arial; 
    display: block; 
    font-size: .85em; 
    padding: 10px; 
} 


/*custom - http://www.webdesignermag.co.uk/tutorials/create-a-responsive-slider-with-the-bxslider-jquery-plugin/*/ 
ul.bxslider{ 
    margin:0; 
} 

#bx-pager { 
    text-align: center; 
    margin-top: 0px; 
    float: left; 
    width: 100%; 
    background-color:#000; 
    padding: 16px; 
} 

#bx-pager img { 
    padding: 5px; 
} 

#bx-pager a:active, 
#bx-pager a.active { 
    border: 2px #FF0000 solid; 
} 
+0

你有.container關閉的div是不存在的。如果您使用.row,則必須使用.container或.container-fluid來包裝它,如果它擴展了頁面的整個寬度,則不需要.row或col類來執行此操作。請參閱:行必須放置在.container(固定寬度)或.container-fluid(全寬度)範圍內,才能正確對齊和填充。 http://getbootstrap.com/examples/grid/ – Christina 2014-09-30 13:48:24

+0

感謝您的信息。 – conmen 2014-10-01 08:51:31

回答

0

因爲你使用的引導行,如果你用你的行固定。

class="myrow"和CSS: 

.myrow{ width:100%; margin:0; paddding:0} 
0

變化.contrainer.contrainer-fluid

行必須放在一個.container(固定寬度)或.container-fluid(全寬),用於正確對準和填充內。

1

我得到這個問題,所以最好的解決辦法

body { 
    overflow-x: hidden; 
}