Home
Image Effects
Image Galleries
and Viewers
Step Carousel Viewer
Integrating an Image Viewer such as Facebox with Carousel Viewer
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
Integrating an Image Viewer such as Facebox with Carousel ViewerYou can integrate an Image Viewer with Carousel Viewer, so clicking on an image within the panels launches the enlarged image in its own fancy viewer. Below you'll see how to do this when the Carousel contents are defined inline on the page, and when they are fetched via Ajax and from an external file instead. For sake of discussion I'll be using the jQuery Image Viewer Facebox, but the same principle applies to most other Image Viewers such as Lightbox or Image Thumbnail Viewer. Integrating Facebox with Carousel Viewer (panels defined inline)If your Carousel Viewer panels are defined inline on the page, integrating
Facebox into it so images within the Panels load using Facebox is
straightforward. First, install Facebox on your page as usual,
as if you're doing so for regular images on the page. Verify that it works with
a test image. Now that you've
verified Facebox is working on the page, to apply it to images within your
Carousel Viewer, just follow the exact same procedure; assuming the Carousel
images are hyperlinked, just give each of these links the requisite <div id="galleryA" class="stepcarousel"> The result:
Note that we're not relying on any of Carousel Viewer's custom event
handlers like Integrating Facebox with Carousel Viewer (panels defined in an external file)If your Carousel Viewer panels are defined inside an external file and
fetched via Ajax, the key is to locate the initialization code for Facebox (or the viewer
you're using), and call that when the Carrousel
Viewer has finished loading, by adding it to the <script type="text/javascript"> What you want to do is move this code into the <script type="text/javascript"> Here are the contents of external.htm btw. Live demo:
The key is defining the code in red within your Carousel configuration code. You may wonder why it's: jQuery('#galleryB a[rel*=facebox]').facebox() instead of the original:
jQuery(document).ready(function($) { Without going in detail all the subtleties, the first code removes unneeded
lines from the original plus takes care of a potential pitfall- be sure to
change " Table Of Contents
|