Ignore:
Timestamp:
Sep 9, 2009, 9:28:56 AM (15 years ago)
Author:
nikrou
Message:

navigation between picture (AK_NEXT, AK_PREVIOUS)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/akBookStyle/trunk/js/ak_jquery-load.js

    r3813 r3838  
    22    $("a.load")
    33      .bind(ak_mouse_event, function() {
    4           $('#akPicture').attr('src', $(this).children('img').attr('src').replace(dir_thumbnail+'\/'+prefix_thumbnail, ''));
     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          }
    544          return false;
    645        });
Note: See TracChangeset for help on using the changeset viewer.