2016-01-14 69 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