Changeset 3876 for extensions/akBookStyle/trunk/js
- Timestamp:
- Sep 19, 2009, 1:02:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/akBookStyle/trunk/js/ak_jquery-load.js
r3838 r3876 3 3 .bind(ak_mouse_event, function() { 4 4 $a = $(this); 5 $thumbnails = $('.thumbnails a[class="load"]'); 6 $nbThumbnails = $thumbnails.length; 5 try { 6 $.get($a.attr('href'),{}, 7 function success(data) { 8 $('#akPicture') 9 .attr('src', data.AK_PIC_SRC) 10 .attr('alt', data.AK_PIC_ALT) 11 .attr('title', data.AK_PIC_TITLE); 7 12 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'); 13 if (data.AK_PREVIOUS) { 14 $('#akPreviousPicture') 15 .removeClass('hide') 16 .attr('href', data.AK_PREVIOUS); 17 } else { 18 $('#akPreviousPicture').addClass('hide'); 19 } 20 if (data.AK_NEXT) { 21 $('#akNextPicture') 22 .removeClass('hide') 23 .attr('href', data.AK_NEXT); 24 } else { 25 $('#akNextPicture').addClass('hide'); 26 } 27 $a.click(function(e) { e.preventDefault();}); 28 }, 29 'json'); 30 } catch (e) { 31 // alert(e); 43 32 } 44 33 return false; 45 34 }); 46 }); 35 });
Note: See TracChangeset
for help on using the changeset viewer.