简体   繁体   English

jQuery Rotator按字母顺序排列,如何在我的主页上使其随机化?

[英]jQuery Rotator Is Alphabetical, how can I make it randomized on my homepage?

How can I get images to be random on my rotator? 如何在旋转器上获得随机图像? Below is a link to the site I am working on and the rotator on the homepage is currently displaying alphabetically and I would like it random. 以下是指向我正在工作的网站的链接,并且主页上的旋转器当前按字母顺序显示,我希望随机显示。

http://www.greatrestaurantsmagazine.com/ http://www.greatrestaurantsmagazine.com/

您可以执行以下操作,例如将列表移至文档片段,然后使用随机化器将其一一添加回去,同时检查尚未尝试添加的项目。

Open up your disolve.js and make the below changes. 打开您的disolve.js并进行以下更改。

key here is randomizing your next image , apparently the code below : 这里的关键是随机化您的下一张图像,显然是下面的代码:

You can download a small demo here 您可以在此处下载一个小演示

Make sure you follow these intstructions in the code 确保遵循代码中的这些说明

//Un-comment the 3 lines below to get the images in random order

var sibs = current.siblings();
var rndNum = Math.floor(Math.random() * sibs.length );                      
var next = $( sibs[ rndNum ] );

And then below your document ready section will look like:

$(document).ready(function() {      
    //Load the slideshow
    $('div.rotator ul').shuffle();
    theRotator();
    $('div.rotator').fadeIn(1000);
    $('div.rotator ul li').fadeIn(1000); // tweek for IE
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在我的网页上设置旋转器/旋转木马的焦点 - how can i set focus of a rotator / carousel on my web page 如何在jquery中随机播放音频时如何运行功能? - How can I run a function while audio is playing randomized in jquery? 当显示带有javascript的项目时,如何确保我的目录列表按字母顺序排序? - How can I make sure that my directory listing sorts in alphabetical order when it displays the items with javascript? 重定向到首页网址后,如何使用Javascript / Jquery实现自动点击? - How can I achieve an autoclick with Javascript / Jquery after being redirected to my homepage url? 如何使用 django 制作类似 twitter 的主页? - How can I make a twitter like homepage with django? 在仍使用React的情况下如何制作静态首页? - How can I make a static homepage while still using React? 如何判断我的页面是否设置为用户的主页? - How can I tell if my page is set as the user's homepage? 如何将我的随机答案放置在不同的div中...阅读文章 - how can i put my randomized answer placement in different divs…Read Post 如何在页面刷新时使我的标题背景图像随机化? - How to make my header background image randomized on page refresh? 如何使偶数随机化或随机化? - How do i make the even numbers shuffle or randomized?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM