I want to make a slideshow carousel that displays the images from a gallery xml file.
我想制作一个幻灯片旋转木马,显示图库xml文件中的图像。
But I have 13 xml file gallery's and I want to random display the gallery's. I'm thinking about using the the elastislide carousel [a link] (http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/)
但我有13个xml文件库,我想随机显示画廊。我正在考虑使用弹性滑动旋转木马[链接](http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/)
hope it is possible im making it for my exam project.
希望我有可能为我的考试项目制作它。
1 个解决方案
#1
0
Exam project, so no direct answer :) but here is set of steps that should guide you on how to go about doing this.
考试项目,所以没有直接答案:)但这里有一套步骤,应该指导你如何去做这件事。
- Use .ajax() function of jQuery to load xml file.
- On each load you can parse an xml using jQuery, just like an html.
- Parse all XML files and create and array of url of image from them.
- Now you can use a random number generator seeded with current time, to pick an image url from array.
- Then use any carousel plugin to display them.
使用jQuery的.ajax()函数加载xml文件。
在每次加载时,您可以使用jQuery解析xml,就像html一样。
解析所有XML文件,并从中创建和映像的url数组。
现在,您可以使用随当前时间播种的随机数生成器,从数组中选择一个图像URL。
然后使用任何carousel插件来显示它们。
If you need to pick an xml file randomly. Create an array with file names, then use same technique to pick random names and load when with .ajax() in jQuery.
如果你需要随机选择一个xml文件。创建一个包含文件名的数组,然后使用相同的技术选择随机名称,并在jQuery中使用.ajax()时加载。
#1
0
Exam project, so no direct answer :) but here is set of steps that should guide you on how to go about doing this.
考试项目,所以没有直接答案:)但这里有一套步骤,应该指导你如何去做这件事。
- Use .ajax() function of jQuery to load xml file.
- On each load you can parse an xml using jQuery, just like an html.
- Parse all XML files and create and array of url of image from them.
- Now you can use a random number generator seeded with current time, to pick an image url from array.
- Then use any carousel plugin to display them.
使用jQuery的.ajax()函数加载xml文件。
在每次加载时,您可以使用jQuery解析xml,就像html一样。
解析所有XML文件,并从中创建和映像的url数组。
现在,您可以使用随当前时间播种的随机数生成器,从数组中选择一个图像URL。
然后使用任何carousel插件来显示它们。
If you need to pick an xml file randomly. Create an array with file names, then use same technique to pick random names and load when with .ajax() in jQuery.
如果你需要随机选择一个xml文件。创建一个包含文件名的数组,然后使用相同的技术选择随机名称,并在jQuery中使用.ajax()时加载。