Here i have some code which is my slideshow and what i am wondering is whether you can randomize the images so it doesn’t start on the same image when you refresh the page.
Please provide me with useful info and if you wish to show me feel free.
THNAKS GUYS! 🙂
<html>
<head>
<title>JQuery Cycle Plugin Sample</title>
<link rel="stylesheet" type="text/css" media="screen" href="../screen.css" />
<script type="text/javascript" src="../js2/jquery-1.3.js"></script>
<script type="text/javascript" src="../js2/jquery.cycle.all.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#myslides').cycle({
fx: 'fade',
speed: 2000,
timeout: 2000
});
});
</script>
</head>
<body>
<div id="myslides">
<img src="../images/capitol.jpg" />
<img src="../images/flowers.jpg" />
<img src="../images/countryscene.jpg" />
<img src="../images/heartkush.jpg"/>
</div>
</body>
</html>
You may want to hold image urls in a variable (or retrieve them from your
divand clear thedivafterwards), say(or even better – do some preloading). Then do a random sort
then dynamically add images
and then do the slideshow. The final script may look like this: