HTML Image Slideshow Generator

Description

  • The following wizard generates the code for creating a image slideshow that will allow visitors to flip through a series of photos on your website. Includes controls and descriptions for your picture slideshow.

Steps

  1. Fill in the settings and name for your slideshow. Autoplay Delay controls how many seconds each image is displayed before going to the next image when "Play" is clicked.
  2. Enter the location of the images in the "Slide Image Address" box for each slide (example http://www.yoursite.com/images/photo.jpg). Next to it you can enter a short description for each image.
  3. Generate the HTML and JavaScript code for your slideshow (button at bottom)
  4. You can preview your script (button at bottom)
  5. Copy and Paste the Source Code into your HTML page

Example

Note

  • There is a version 2 of this slideshow which contains many more options. However, it also takes up much more code.
  • Version 1.6 I added "Side Show ID" which allows you to have more than one slideshow on the same page. For each new slideshow on the page, you will need to give it a unique ID (eg; slide1, slide2, slide3, etc). If you are only going to have one slideshow one the page, you can leave this setting unchanged.


Slide Show (version 1.6)
Autoplay Delay: Seconds
Slide Show Title:
Slide Show ID:
(change ID if multiple slideshows are on one page)
Slide Show Image Entries
Slide Image Address Slide Text Description



Source Code

Comments

First, thank you for the slideshow. It's just what we were looking for.
How can we change the height and width the cell where the description is displayed? Some of our descriptions are lengthy.

If you have many long descriptions, you might be better off using the more advanced slideshow which has the descriptions in plain text (which is much more customizable).

You can also change the font size/style on this slideshow to make the text not appear so big. You change the:
<select name="slide" onChange="rotate(this.selectedIndex);">
to something like
<select name="slide" onChange="rotate(this.selectedIndex);" style="font:10px Arial;">

Thank you very much. I've spend about 5 hours looking for something simple as this (and in a simple code which I can modify a little for my needs).
I was wondering if it was possible to enable an autostart (when the page is loaded), without clicking the start button.
Thanks again!

I was having problems getting the above autoplay-on-load feature working when I used multiple slideshows on the same page. I found the issue was related to the "Slide Show ID." There were 2 places in the code I needed to specify the name of the form/slideshow.

Here is what I came up with:
window.onload=function(){document.ff_NAMEOFMYSLIDESHOW.fa.value="Stop";auto_NAMEOFMYSLIDESHOW();}

In BOLD are the critical missing elements if you are using a custom slideshow ID (other than the default "slide1" one).

Just wanted to share my results. Thank you again!

Thank you so much for making this code available. I just can't figure out how to get more than one show to autoplay. I did use the suggestion made to add the ID in two places. The web page I am working with is http://www.countrysideinpa.org/development_page_2.htm. Only the first slideshow autoplays when the page opens. Any help would be much appreciated. Following is the page in code:

<script type="text/javascript">
// Author: ricocheting.com
// Description: slideshow that allows visitors to flip through a series of images on your website

var x_splashpics1=0;

function rotate_splashpics1(num){
fs=document.ff_splashpics1.slide;
x_splashpics1=num%fs.length;
if(x_splashpics1<0) x_splashpics1=fs.length-1;
document.images.show_splashpics1.src=fs.options[x_splashpics1].value;
fs.selectedIndex=x_splashpics1;}

function auto_splashpics1() {
if(document.ff_splashpics1.fa.value == "Stop"){
rotate_splashpics1(++x_splashpics1);setTimeout("auto_splashpics1()", 4000);}}window.onload=function(){document.ff_splashpics1.fa.value="Stop";auto_splashpics1();}
</script>

<form name="ff_splashpics1">
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;" align="center">
<tr><th align="center"></th></tr>

<tr><td align="center">
<img src="images\WebBannerPic110.jpg" name="show_splashpics1">
</td></tr>

<tr><td align="center" style="border:1px black solid;">
<select name="slide" onChange="rotate_splashpics1(this.selectedIndex);">
<option value="images\WebBannerPic110.jpg"></option>
<option value="images\WebBannerPic102.jpg"></option>
<option value="images\WebBannerPic116.jpg"></option>
<option value="images\WebBannerPic111.jpg"></option>
<option value="images\WebBannerPic124.jpg"></option>
<option value="images\WebBannerPic122.jpg"></option>
<option value="images\WebBannerPic104.jpg"></option>
<option value="images\WebBannerPic121.jpg"></option>
<option value="images\WebBannerPic127.jpg"></option>
</select>
</td></tr>

<tr><td align="center" style="border:1px black solid;">
<input type="button" onclick="rotate_splashpics1(0);" value="ll&lt;&lt;" title="Jump to beginning" />
<input type="button" onclick="rotate_splashpics1(x_splashpics1-1);" value="&lt;&lt;" title="Last Picture" />
<input type="button" name="fa" onClick="this.value=((this.value=='Stop')?'Start':'Stop');auto_splashpics1();" value="Start" title="Autoplay" style="width:75px;" />
<input type="button" onclick="rotate_splashpics1(x_splashpics1+1);" value="&gt;&gt;" title="Next Picture" />
<input type="button" onclick="rotate_splashpics1(this.form.slide.length-1);" value="&gt;&gt;ll" title="Jump to end" />
</td></tr></table></form>




<script type="text/javascript">
// Author: ricocheting.com
// Description: slideshow that allows visitors to flip through a series of images on your website

var x_splashpics2=0;

function rotate_splashpics2(num){
fs=document.ff_splashpics2.slide;
x_splashpics2=num%fs.length;
if(x_splashpics2<0) x_splashpics2=fs.length-1;
document.images.show_splashpics2.src=fs.options[x_splashpics2].value;
fs.selectedIndex=x_splashpics2;}

function auto_splashpics2() {
if(document.ff_splashpics2.fa.value == "Stop"){
rotate_splashpics2(++x_splashpics2);setTimeout("auto_splashpics2()", 4000);}window.onload=function(){document.ff_splashpics2.fa.value="Stop";auto_splashpics2();}

</script>

<form name="ff_splashpics2">
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;" align="center">
<tr><th align="center"></th></tr>

<tr><td align="center">
<img src="images\WebBannerPic103.jpg" name="show_splashpics2">
</td></tr>

<tr><td align="center" style="border:1px black solid;">
<select name="slide" onChange="rotate_splashpics2(this.selectedIndex);">
<option value="images\WebBannerPic103.jpg"></option>
<option value="images\WebBannerPic115.jpg"></option>
<option value="images\WebBannerPic106.jpg"></option>
<option value="images\WebBannerPic112.jpg"></option>
<option value="images\WebBannerPic107.jpg"></option>
<option value="images\WebBannerPic101.jpg"></option>
<option value="images\WebBannerPic126.jpg"></option>
<option value="images\WebBannerPic120.jpg"></option>
<option value="images\WebBannerPic105.jpg"></option>
</select>
</td></tr>

<tr><td align="center" style="border:1px black solid;">
<input type="button" onclick="rotate_splashpics2(0);" value="ll&lt;&lt;" title="Jump to beginning" />
<input type="button" onclick="rotate_splashpics2(x_splashpics2-1);" value="&lt;&lt;" title="Last Picture" />
<input type="button" name="fa" onClick="this.value=((this.value=='Stop')?'Start':'Stop');auto_splashpics2();" value="Start" title="Autoplay" style="width:75px;" />
<input type="button" onclick="rotate_splashpics2(x_splashpics2+1);" value="&gt;&gt;" title="Next Picture" />
<input type="button" onclick="rotate_splashpics2(this.form.slide.length-1);" value="&gt;&gt;ll" title="Jump to end" />
</td></tr></table></form>
 

You have two onloads that are overwriting each other:
window.onload=function(){document.ff_splashpics1.fa.value="Stop";auto_splashpics1();}
window.onload=function(){document.ff_splashpics2.fa.value="Stop";auto_splashpics2();}
Remove those and combine them into a single one:
window.onload=function(){document.ff_splashpics1.fa.value="Stop";auto_splashpics1();document.ff_splashpics2.fa.value="Stop";auto_splashpics2();}

Is there any way that the photos from the slide show be made to resize to fit screen? I have some portrait and some landscape. I can force a fixed size but that distorts my image. If I don't put in the size control then my images are too large and the controls are off screen.

You can stick a width="640" property on the <img> and NOT put the height tag. That generally allows the height to automatically adjust so the image won't distort.

However, for the best results you should edit/resize the images themselves before you upload them to your website.

If I wanted to change the background color of the slideshow, could I? Currently, it appears transparent, allowing the background of the website to show through. How would I go about setting the slideshow's background color to something different?

If you want to change the background color of the entire thing, you can edit the table
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;">
and update it to the hex color value to the color you want.
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;background:#C0C0C0;">

If you want to set a static width and height, you can edit the table
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;">
and update it to the width and height you want.
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;" width="350" height="600">

Hi great code, works very well and I appreciate the work and glad to give you the link.

I would like to have the show stop at the end of the images instead of a continuous loop.

Have a great Day!

Change the autoplay function from something like (the 5000 number might be different depending on Autoplay Delay entered):

function auto() {
if(document.ff.fa.value == "Stop"){
rotate(++x);setTimeout("auto()", 5000);}}
to
function auto() {
if(document.ff.fa.value == "Stop" && x!=document.ff.slide.length-1){
rotate(++x);setTimeout("auto()", 5000);}
else{document.ff.fa.value="Start"}}

I would like to remove the play buttons and the slide selector. How would I do that without messing up the sideshow from running?

[edit]
Is there a way to simply hide the Slide Selector so its function is still there, but it won't be shown on the webpage?

I ask because i need to put multiple slides on one page and Slideshow v2.0 doesn't allow that

You can remove the play/stop/next/last/prev buttons if you want. However the Slide Selector is required as that is where the actual slide URLs are stored so it can't be removed-removed.

However, you had an interesting idea. You can hide the table row that contains selector. Change:
<tr><td align="center" style="border:1px black solid;">to
<tr><td align="center" style="display:none;">
I tried it and it works in IE8, FF3.6, Chrome6.

Can you give specific instructions as to what to remove from the code to get rid of the play/stop/next/last/prev buttons?

To remove the play/stop/next/last/prev buttons, delete (or comment out) the following:

<tr><td align="center" style="border:1px black solid;">
<input type="button" onclick="rotate(0);" value="ll&lt;&lt;" title="Jump to beginning" />
<input type="button" onclick="rotate(x-1);" value="&lt;&lt;" title="Last Picture" />
<input type="button" name="fa" onClick="this.value=((this.value=='Stop')?'Start':'Stop');auto();" value="Start" title="Autoplay" style="width:75px;" />
<input type="button" onclick="rotate(x+1);" value="&gt;&gt;" title="Next Picture" />
<input type="button" onclick="rotate(this.form.slide.length-1);" value="&gt;&gt;ll" title="Jump to end" />
</td></tr>

What would I need to do in order to use the buttons in image mapping.
Like, say I made two images of buttons (<< & >>) and wanted them to act as back and forward instead of the buttons it creates, what would I need to do?

replace the four buttons with:

<a href="#" onclick="rotate(0);return false;"><img src="start.jpg"></a>
<a href="#" onclick="rotate(x-1);return false;"><img src="prev.jpg"></a>

<a href="#" onclick="rotate(x+1);return false;"><img src="next.jpg"></a>
<a href="#" onclick="rotate(this.form.slide.length-1);return false;"><img src="end.jpg"></a>
replacing the images with your own of course.

Mine keeps aligning to the left of my screen? How do I center it?

The table the slideshow is in can be aligned to the center. Change:
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;">to:
<table cellpadding="3" style="border:1px black solid;border-collapse:collapse;" align="center">

I'm getting this error when I generate the code, but there are only letters in my ID. I've taken out spaces and everything. Lil' help.
[edit] I found out the issue was a letter can't be capitalized. Thanks.

is there any way the slideshow could NOT loop back to the first image when the user clicks all the way to the end, like the "next" button would not do anything once theyve reached the end so it just stops.

to prevent it from rolling over and starting again, change:

x=num%fs.length;
if(x<0) x=fs.length-1;
to:
x=num;
if(x>=fs.length) x=fs.length-1;
if(x<0) x=0;

I really love your slideshow. It's exactly what I need for a special application. It seems to only handle 0-9 slides-need to increase to 16. What would I need to do to change that? Thanks.

Down near the bottom there should be a list stores the slides:

<option value="http://ricocheting.com/slideshow_thumb_alpine.jpg" selected>Olympic National Park</option>
<option value="http://ricocheting.com/slideshow_thumb_rainier.jpg">Mount Rainier National Park</option>
<option value="http://ricocheting.com/slideshow_thumb_teton.jpg">Teton National Park</option>
<option value="http://ricocheting.com/slideshow_thumb_jasper.jpg">Jasper National Park</option>

The first part contains the slide image URL then the second part contains the slide description. Just keep adding as many more as you need.

I am trying to make it so that if I click on an image outside of the entire form, but its still on the same page as the slideshow that when it is clicked the slideshow will jump to that image. How could I do that? I'm thinking that it could be a link associated with the options values somehow.

You can create links to jump to a specific slide like:
<a href="javascript:rotate(2);">Jump to slide</a>Where 2 in is the slide number (would be the third slide in this case as it starts from zero: 0,1,2)

This simple slideshow doesn't really support things like linking the photos. However, the more advanced Slideshow v2.0 does have that option.