| 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 |
|