Submit FAQs Awards Usage Terms Contact
Categories
Partners
DaniWeb is an exciting community for web developers, Internet marketers, and technology enthusiasts.
Other Sections
Compatibility
Bookmark online:

Firefox1+ IE5+ Opera 7+

Ultimate Fade-in slideshow (v1.51)

Author: Dynamic Drive

Note: July 24th, 07': Updated to v1.51, which fixes transitional effect not working in Safari 3.x. Thanks to jscheuer1 for his help.

Description: This is a robust, cross browser fade in slideshow script that incorporates some of your most requested features. They are the ability to display multiple slideshows on the same page, optional linking and link targeting for certain images, and the ability to randomize the display order of the images. You can also set the slideshow to pause when the mouse moves over it. Each instance of a fade in slideshow on the page is completely independent of the other, meaning the aforementioned features can be customized for each slideshow. The cool fading effect works in IE, NS6+/ Firefox, and Safari 2, while all other browsers such as Opera 8 will simply skip the effect but continue to display the images. Rock on with the ultimate fade in slideshow script!

Demo (first slideshow pauses onMouseover):


Directions Developer's View

Step 1: Insert the following script to the HEAD section of your page:

Select All

Configure the array "fadeimages[]" to reference the images you want to be displayed.

Step 2: All that's left now is to insert the below code into the BODY of your page where you want the slideshow(s) to be displayed.

Select All

The code above shows how to invoke two separate fade in slideshows, each with varying parameters. Here's an explanation of how to invoke function "fadeshow()":

new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause, optionalRandomOrder)
  1. IMAGES_ARRAY_NAME: The name of the image array (inside script of Step 1) containing the images to display for this slideshow (ie: "fadeimages".
  2. slideshow_width: The width of the slideshow container (implied in px). Set it to accommodate the largest image within the slideshow.
  3. slideshow_height: The height of the slideshow container (implied in px). Set it to accommodate the largest image within the slideshow.
  4. borderwidth: The width of the border, such as 0, 1 etc.
  5. delay: Delay between image change, in milliseconds (ie: 3000 = 3 seconds).
  6. pause: Specify whether slideshow should pause (not rotate) while the mouse is over it. 1=yes, 0=no.
  7. optionalRandomOrder: An optional parameter specifying whether to "randomize" the display order of the images. Set it to "R" to randomize, or remove this parameter (unset) to not.

As mentioned, you can invoke "fadeshow()" multiple times on the same page to display multiple fade in slideshows. Fade away we say!

Finally, some people have asked "How do I center the slideshow? Since IE and Firefox/Opera behaves differently when it comes to positioning a relatively positioned element, you'll need to use some Frankenstein CSS:

<style type="text/css">
.centerdiv{ /*IE method of centering a relative div*/
text-align: center;
}

.centerdiv>div{ /*Proper way to center a relative div*/
margin: 0 auto;
}
</style>

<body>
<div class="centerdiv">
CODE OF STEP 2 HERE
</div>
</body>

As you can see, to center a particular slideshow, wrap the code of Step 2 for that slideshow in a special DIV. Do this for each slideshow that you wish centered. The stylesheet obviously should go in the HEAD section of your page.

Recent Change Log

  • Dec 6th, 05'. Updated to v1.5, with ability to pause slideshow onMouseover, greater efficiency in IE, and compatibility in IE5.5, IE5, and IE4.
  • Nov 30th, 05'. Script rewritten for various enhancements, such as multiple slideshows per page. Now called Ultimade fade-in slideshow v1.0
  • April 21st, 05'. Added link and link target ability for individual images.