jQuery Panel Gallery Plugin 1.2
I’m happy to announce the release of version 1.2. This version adds the ability to pause the transitions simply by placing your mouse over the image as well as specify an amount of overlap in terms of the time of the section transitions.
The best part of this plugin is that not one image needs to be sliced or edited to work with it. Next, you can choose the direction in which the transition occurs from left to right, right to left, top to bottom, or bottom to top – now for each image individually. You can set the initial delay before the transitions begin, set the transitions to loop or stop after the last image, set the time it takes for each panel to appear, and set the delay between the images. Phew.
Download
Download jquery.panelgallery-1_2.js
What’s So Great About this Plugin?
- No slicing or editing of the images is needed
- It’s just 8 KB
- Each image can have its own fade direction
- The gallery can be set to pause on mouseover (new)
- Section transition timing can be set to overlap (new)
- Easily configurable
- Reusable on multiple containers
How to Use
First, all of your images should be the same size and wrapped in a containing element
(I recommend a div) which must have an ID. Any images will work, however transparent images aren’t recommended. Finally, your container element should be positioned (e.g. relative, absolute, etc.). The container needs to be positioned otherwise the images within it won’t end up in the right spot on your page.
<div id="container" style="position:relative"> <img src="image1.jpg" alt="image 1" width="500" height="250" /> <img src="image2.jpg" alt="image 2" width="500" height="250" /> <img src="image3.jpg" alt="image 3" width="500" height="250" /> . . . </div>
All images *MUST* have the width and height declared otherwise the plugin won’t
work in Safari, Chrome, and any other webkit-based browsers. Also, all images should
be the same size. You can mix various image formats like Gif, Jpg, and Png, however
transparent images aren’t recommended.
To use the plugin you’ll need to have a copy of jQuery, or point to jquery on Google, and the plugin. Place the files on your site and link to them:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.panelgallery-1_1.js"></script> <script type="text/javascript"> $(function(){ $('#container').panelGallery(); }); </script>
Finally, while you don’t have to specify any directions for the fade (the default direction is left to right), you can give each image it’s own direction. To do this, add the name attribute to the image and specify either (lr, rl, tb, or bt). For example:
<img src="image2.jpg" alt="image 2" name="bt" width="500" height="250" />
That’s it! You can apply the panel gallery to any number of elements on a page.
Options
The following options are configurable:
- sections – the number of panels to divine each image into (default: 3)
- imageTransitionDelay – the time (in milliseconds) to pause between a
completed image and the next image (default: 3000) - startDelay – the time (in milliseconds) to pause before beginning the first transition (default: 2000)
- sectionTransitionDelay – the time (in milliseconds) to pause between each section of an image (default: 700)
- overlap – the percentage of the sectionTransitionDelay option a section should wait before beginning (0 to 1). For example, if the sectionTransitionDelay is 1000 milliseconds and the overlap is set to .75, then at 750 milliseconds the next section transitions will begin. If you want a section to fully complete before the next section begins, set this to 1. (default: .75)
- enablePause – whether or not to pause the animations when the mouse is placed over an image (default 1).
- repeat – whether to endlessly repeat the series of images (default: true)
- direction – the default direction of the transitions: “lr” (left to right), “rl” (right to left), “tb” (top to bottom), and “bt” (bottom to top) (default: “lr”)
Options are added when calling the script:
$('#container').panelGallery({
sections:5,
imageTransitionDelay :3000,
startDelay:5000,
sectionTransitionDelay : 700,
repeat:false,
direction:"tb"
});
Enjoy!

