jCarouselLite 随机启动顺序
我正在使用 JCarouselLite (http://www.gmarwaha.com/blog/2007/08/09/jcarousel-lite-a-jquery-plugin/) 生成一个垂直滚动的“新闻收报机”风格的推荐和所有内容轮播工作正常,但我想随机化列表项的显示顺序。我尝试使用以下命令,但它不起作用:
if(o.random){var randomStart = Math.floor( Math.random()*tl+1 );curr = randomStart;}
然后将“random: true,”添加到选项中。
有人可以帮我解决这个问题吗? 我的脚本是:
<script type="text/javascript">
$(document).ready(function(){
$(".ticker").jCarouselLite({
auto: 10000,
vertical: true,
random: true,
visible: 1
});
});
</script>
I'm using JCarouselLite (http://www.gmarwaha.com/blog/2007/08/09/jcarousel-lite-a-jquery-plugin/) to generate a vertical scrolling "news ticker" style carousel of testimonials and everything is working perfectly, but I would like to randomize the order in which the list items are displayed. I attempted to use the following, but it's not working:
if(o.random){var randomStart = Math.floor( Math.random()*tl+1 );curr = randomStart;}
Then Add "random: true," to the options.
Can someone please help me figure this out?
My Script is:
<script type="text/javascript">
$(document).ready(function(){
$(".ticker").jCarouselLite({
auto: 10000,
vertical: true,
random: true,
visible: 1
});
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
start
属性并将其设置为从 0 到您拥有的最大项目数的随机数。Use the
start
property and set it to a random number starting from 0 to the maximum number of items you have.