PDA

View Full Version : Resolved Crossfade slideshow



naveen.brite
04-13-2010, 10:20 AM
HI,

I have implemented a jquery slideshow. Every thing is fine with its working.
But i want random image to appear every time the page is viewed. Is there any possibility for that?

The slideshow about which i am speaking can be found in the below link.
http://www.jirehdesigners.com/HIDDEN/


The script inside of the page:
<script type="text/javascript" src="js/jquery.cross-slide.js" language="javascript"></script>

<script type="text/javascript">
jQuery(function() {
jQuery('#ccc').crossSlide({
sleep: 5,
fade: 3
}, [
{ src: 'pictures/Croatia-2.jpg' },
{ src: 'pictures/Galapagos.jpg' },
{ src: 'pictures/Vietnam-Beach.jpg' },
{ src: 'pictures/Antarctica.jpg' },
{ src: 'pictures/Canada.jpg' },
{ src: 'pictures/Elephant Expeditions main page.jpg' },
{ src: 'pictures/Indochina main page.jpg' },
{ src: 'pictures/Laos main page.jpg' }
]);
});
</script>

This is the div:

<div id="ccc" class="contentdiv">Loading....</div>
Please help me.
Thank you very much in advance.

vwphillips
04-13-2010, 01:24 PM
jQuery(function() {
var ary=['pictures/Croatia-2.jpg','pictures/Galapagos.jpg','pictures/Vietnam-Beach.jpg','pictures/Antarctica.jpg','pictures/Canada.jpg','pictures/Elephant Expeditions main page.jpg','pictures/Indochina main page.jpg','pictures/Laos main page.jpg'];
ary.shuffle();
jQuery('#ccc').crossSlide({
sleep: 5,
fade: 3
}, [
{ src: ary[0] },
{ src: ary[1] },
{ src: ary[2] },
{ src: ary[3] },
{ src: ary[4] },
{ src: ary[5] },
{ src: ary[6] },
{ src: ary[7] }
]);
});

Array.prototype.shuffle=function(){
for (var r,t,z0=0;z0<this.length;z0++){
r=Math.floor(Math.random()*this.length);
t=this[z0];
this[z0]=this[r];
this[r]=t;
}
}

naveen.brite
04-13-2010, 04:21 PM
Thanks a lot....
The code that you have written is the perfect solution.:)
Really helpful.
Thank you very much....