Monday, May 11, 2009

Corousel

Carousel Slideshow

Description: Carousel Slideshow is a fabulous DHTML script for the showcasing of images on your site. It displays images in a 3D, carousel fashion. Highlights of this script other than its stunning appearance are:

  • Slideshow can be set to either slide in from right to left, or the reverse.

  • Slideshow can be set to be 4-sided, 6, 8, or 12. A 4-sided slideshow for example means 2 images will be in view at all times (the other two behind the scene).

  • Each image can have an optional link associated with it.

  • Slideshow pauses on mouseover.

  • A DOM based script that works in modern DHTML browsers- IE5+, NS6+, Opera 7+. 

Are you impressed yet?

Demo (6-sided):


Directions Developer's View

Step 1: Insert the below script into the BODY section of your page where you wish the slideshow to appear:

Select All

Step 2: Download the the below image "placeholder.gif", which the above script requires and references:

(enlarged for easier download. Right click and choose "Save As").

Step 3: Finally, add the below onload event handler inside the <BODY> tag itself:

<body onload="Carousel()"> 

That's a wrap. Read on for important customization info.

Customizing the script

All changes to the script takes place in the code of Step 1, which is documented for the purpose. First, customize the 7 variables near the top of the script per the comments. Then, locate the <DIV> tag at the bottom of the code, which reads:

<div id="Carousel" style="position:relative">
<img src="placeholder.gif" width="371" height="227">
</div>

This is where things get interesting. You now need to change the width and height of the "placeholder.gif" image above using the preset formula:

placeholder width:
-4 sided: 1.42 * carousel image width + 3
-6 sided: 2 * carousel image width +4
-8 sided: 2.62 * carousel image width + 5
-12 sided: 3.87 * carousel image width + 7

placeholder height: 
-carousel image height+2

In other words, depending on the number of sides your Carousel slideshow is set to, the width and height of the placeholder.gif image needs to change accordingly. In the demo, the slideshow is 8-sided, with images each having a dimension of "140" and "225". So the placeholder.gif is set to "371" (2.62*140+5) and "227" (225+2).

And that's it. FYI the above customization steps are repeated within the script for easy reference.

No comments:

Post a Comment