Hello I'm having trouble coming up with a javascript that can cycle through a set of images, and is able to set length of time that each image is displayed? I don't want any extra buttons, fade transitions, etc.. Just a simple automatic image cycler. Javascript or jQuery is fine, whatever can get the job done. Any idea?
Hello I'm having trouble coming up with a javascript that can cycle through a set of images, and is able to set length of time that each image is displayed? I don't want any extra buttons, fade transitions, etc.. Just a simple automatic image cycler. Javascript or jQuery is fine, whatever can get the job done. Any idea?
Here is a very simple script which may be sufficient for your purposes. The time each image is displayed is 2000 millseconds = 2 seconds, naturally you can alter that.
Code:
<html>
<head>
</head>
<body onload = "show(); setInterval(show,2000)">
<img id="photoslider">
<script type = "text/javascript">
var photos=[];
photos[0]="myimage1.jpg";
photos[1]="myimage2.jpg";
photos[2]="myimage3.jpg";
photos[3]="myimage4.jpg";
photos[4]="myimage5.jpg";
photos[5]="myimage6.jpg";
photos[6]="myimage7.jpg";
photos[7]="myimage8.jpg";
photos[8]="myimage9.jpg";
photos[9]="myimage10.jpg";
var count = 0;
function show() {
document.getElementById("photoslider").src=photos[count];
count ++;
if (count >9) {count = 0}
}
</script>
</body>
</html>
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Wow lots of good stuff there, however these are all too fancy for what I need here, unless I missed it in the list. I don't want anything besides the images themselves to appear (I don't want previous/next buttons, thumbnails, transitions, etc).
Wow lots of good stuff there, however these are all too fancy for what I need here, unless I missed it in the list. I don't want anything besides the images themselves to appear (I don't want previous/next buttons, thumbnails, transitions, etc).
See the simple script which I added to my post two minutes before your second post.
Edit: I interpreted your request to set the length of time as applying to all the images, but vic below allows you to show each image for a different length of time if you wish.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Is it possible to somehow add css styling to each individual image under the var photos list? Say if I wanted to move third image down 5px, how would I do that?
Is it possible to somehow add css styling to each individual image under the var photos list? Say if I wanted to move third image down 5px, how would I do that?
Which post above is the current code you are trying to modify?