2016-01-14 119 views
1

的jCarousel垂直滾動不工作

$(function() { 
 
$('.jcarousel') 
 
\t \t \t \t .jcarousel({ 
 
\t \t \t \t \t auto: 1, 
 
\t \t \t \t \t animation: { 
 
\t \t \t \t \t \t duration: 3000, 
 
\t \t \t \t \t \t easing: 'linear', 
 
\t \t \t \t \t }, 
 
\t \t \t \t \t vertical: true, 
 
\t \t \t \t \t wrap: 'last' 
 
\t \t \t }).jcarouselAutoscroll({ 
 
\t \t \t \t \t interval: 3000, 
 
\t \t \t \t \t target: '+=1', 
 
\t \t \t \t \t autostart: true 
 
\t \t \t \t }); 
 
});
ul li { 
 
    list-style-type: none; 
 
} 
 

 
.jcarousel { 
 
    position: relative; 
 
    overflow: hidden; 
 
    width: 100%; 
 
    height: 88px; 
 
} 
 

 
.jcarousel li { 
 
    float: left; 
 
    width: 100%; 
 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jcarousel/0.3.4/jquery.jcarousel.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div class="row"> 
 
    <div class="jcarousel"> 
 
    <ul> 
 
     <li> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
 
     survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
     publishing software like Aldus PageMaker including versions of Lorem Ipsum.</li> 
 
     <li> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
 
     survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
     publishing software like Aldus PageMaker including versions of Lorem Ipsum.</li> 
 
     <li> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
 
     survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
     publishing software like Aldus PageMaker including versions of Lorem Ipsum.</li> 
 
     <li> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
 
     survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
     publishing software like Aldus PageMaker including versions of Lorem Ipsum.</li> 
 
     <li> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
 
     survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop 
 
     publishing software like Aldus PageMaker including versions of Lorem Ipsum.</li> 
 
    </ul> 
 
    </div> 
 
</div>

所述UL容器是表示頂部位置所計算出的樣式改變,但轉盤犯規滾動的內容。請幫忙。這是jCarousel Version。這是我的Codepen。只需要最後一塊垂直滾動條即可工作。

回答

2

它不是滾動,因爲你缺少這個CSS:

.jcarousel ul { 
    position: relative; 
} 

如果你看一下DOM檢查正在申請topleft造型,但沒有移動。那是因爲造型適用於ul,但它需要position: relative。現在你需要發揮自己的高度和多一點東西,現在它滾動來獲得你想要的效果,但現在你應該開始看到期望。

編輯:對不起,我錯過了你清楚地表明你看到了已經應用的樣式。無論哪種方式添加上面的CSS,它應該開始工作。

+1

謝謝!!!!太棒了,那你幫忙! – alphapilgrim

+0

樂意幫忙!祝你好運! – AtheistP3ace