2012-10-07 51 views
1

我正在使用jQuery.cycle來顯示三個圖像。與本網站上的其他答案保持一致,我使用了min-widthoverflow:hidden的組合來刪除水平滾動條,該滾動條僅出現在Internet Exploder Nein中。溢出隱藏不從IE中的jQuery循環中刪除水平滾動條

如果相關,該站點同時使用Yii框架和Blueprint。

水平滾動條不會消失。爲什麼?

行動

<?php 
class IndexAction extends CAction 
{ 
    public function run() 
    { 
     $ds = DIRECTORY_SEPARATOR; 
     $cs = Yii::app()->clientScript; 

     $cs->registerScriptFile($ds. 'js' . $ds . 
        'jquery.cycle.all.js', CClientScript::POS_HEAD); 

     $cs->registerScript('cycle', "$('.pics').cycle({ 
      fx: 'scrollLeft', 
      containerResize: false, 
      slideResize: false, 
      width:960, 
      height:300, 
      fit:true 
     });", CClientScript::POS_END); 

     $this->controller->render('index'); 
    } 
} 

查看

<?php 
Yii::app()->clientScript->registerCss('ServicesCycleSlideShow'," 
.pics { 
    min-width:960px; 
    height:300px; 
    padding:0; 
    margin:0; 
    overflow:hidden; 
} 

.pics img { 
    padding: 0; 
    margin: 0; 
    border: none; 
    min-width: 960px; 
    height: 300px; 
    overflow:hidden; 
}"); 
?> 
<div class="pics"> 
    <img src="/images/1.png" width="960" height="300" /> 
    <img src="/images/2.png" width="960" height="300" /> 
    <img src="/images/3.png" width="960" height="300" /> 
</div> 

回答

3

我發現這個問題。 jQuery.cycle引入了overflow-x:scroll,它優先於overflow:hidden。添加overflow-x:hidden刪除滾動條。