/[drupal]/contributions/modules/cck_multimage/cck_multimage.js
ViewVC logotype

Contents of /contributions/modules/cck_multimage/cck_multimage.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sat Aug 18 05:47:22 2007 UTC (2 years, 3 months ago) by silviogutierrez
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, DRUPAL-5--1-2, HEAD
Branch point for: DRUPAL-5
Changes since 1.1: +6 -1 lines
File MIME type: text/javascript
*** empty log message ***
1 $(document).ready(function(){
2
3 $('.multimage-image').each(function() {
4
5 if (Drupal.settings[$(this).attr('id') + '-mode'] == 'single')
6 return;
7
8
9 var images = Drupal.settings[$(this).attr('id')];
10 var captions = Drupal.settings[$(this).attr('id') + '-captions'];
11
12 var container = $(this).parent().parent(); //Unused variable, for future additions.
13 var top = $(this).parent();
14 var bottom = $(this).parent().next();
15 var buffer = $(this).parent().next().next();
16
17 //Load all images as soon as the page loads, that way the user won't have to wait on each click.
18 for (x = 0; x < images.length; x++) {
19 buffer.attr('src', images[x]); //GET method in JQuery 1.01 is buggy when used in IE, so buffering must be done 'manually'.
20 }
21 var count = 1;
22 $(this).click(function() {
23 if (count == images.length )
24 count = 0;
25
26 bottom.fadeOut(200);
27 top.fadeOut(200, function(){
28
29 $(this).children().attr('src', images[count]);
30 bottom.html(captions[count]);
31 top.fadeIn(200);
32 bottom.fadeIn(200);
33 count++;}
34 );
35
36
37 });
38 });
39 });
40

  ViewVC Help
Powered by ViewVC 1.1.2