Reputation: 5761
I found this nice function which fades in and out content in order from image1 to image 4. However would be possible if I refresh the page to load the images randomly?
image2, image4, image,1 image3
The idea is to have a random order every time I refresh the page.
$(function(){
$('.fadein p:gt(0)').hide();
setInterval(function(){$('.fadein > :first- child').fadeOut().next('p').fadeIn().end().appendTo('.fadein');}, 3000);
});
HTML
<div class="fadein">
<p>image1</p>
<p>image2</p>
<p>image3</p>
<p>image4</p>
</div>
Upvotes: 1
Views: 1161
Reputation: 121998
If you have no problem with this light weight plugin, You can try this plugin
$(document).ready(function() {
$(".fadein").shuffle();
});
Upvotes: 3