Last change
on this file since 3838 was
3838,
checked in by nikrou, 15 years ago
|
navigation between picture (AK_NEXT, AK_PREVIOUS)
|
File size:
1.3 KB
|
Line | |
---|
1 | $(function() { |
---|
2 | $("a.load") |
---|
3 | .bind(ak_mouse_event, function() { |
---|
4 | $a = $(this); |
---|
5 | $thumbnails = $('.thumbnails a[class="load"]'); |
---|
6 | $nbThumbnails = $thumbnails.length; |
---|
7 | |
---|
8 | $previous_link = $current_link = $next_link = null; |
---|
9 | |
---|
10 | $('.thumbnails a[class="load"]') |
---|
11 | .each( function(i) { |
---|
12 | if ($(this).attr('href')==$a.attr('href')) { |
---|
13 | $current_link = $(this); |
---|
14 | if (i>0) { |
---|
15 | $previous_link = $thumbnails[i-1]; |
---|
16 | } |
---|
17 | if (i<$nbThumbnails) { |
---|
18 | $next_link = $thumbnails[i+1]; |
---|
19 | } |
---|
20 | } |
---|
21 | }); |
---|
22 | |
---|
23 | $current_link = $('.thumbnails a[href='+$(this).attr('href')+']'); |
---|
24 | $src = $current_link.children('img').attr('src'); |
---|
25 | $src = $src.replace(dir_thumbnail+'\/'+prefix_thumbnail, ''); |
---|
26 | |
---|
27 | $('#akPicture').attr('src', $src); |
---|
28 | if ($previous_link) { |
---|
29 | if ($('#akPreviousPicture').hasClass('hide')) { |
---|
30 | $('#akPreviousPicture').removeClass('hide'); |
---|
31 | } |
---|
32 | $('#akPreviousPicture').attr('href', $($previous_link).attr('href')); |
---|
33 | } else { |
---|
34 | $('#akPreviousPicture').addClass('hide'); |
---|
35 | } |
---|
36 | if ($next_link) { |
---|
37 | if ($('#akNextPicture').hasClass('hide')) { |
---|
38 | $('#akNextPicture').removeClass('hide'); |
---|
39 | } |
---|
40 | $('#akNextPicture').attr('href', $($next_link).attr('href')); |
---|
41 | } else { |
---|
42 | $('#akNextPicture').addClass('hide'); |
---|
43 | } |
---|
44 | return false; |
---|
45 | }); |
---|
46 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.