Guest User

Untitled

a guest
Jun 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. $(function() {
  2. var end = <?=$total_images?>;
  3. var imgWrapper = $('#propgallery > img');
  4.  
  5. imgWrapper.hide().filter(':first').show();
  6.  
  7. $(".prev").removeAttr('href');
  8. $(".prev > img").attr('src','Images/photo_left_disable.png');
  9.  
  10. if(end==1){
  11. $(".next").removeAttr('href');
  12. $(".next > img").attr('src','Images/photo_right_disable.png');
  13. }
  14.  
  15. $('#counter').html( "1/"+end );
  16.  
  17. var caption = $('img#1').attr('name');
  18. $('.caption').html(caption);
  19.  
  20. $('#propgalnav a').click(function () {
  21.  
  22. if(end!=1){
  23. if(this.hash=="#prev"){
  24. count = parseInt($(this).attr('id')) - 1;
  25. }else if(this.hash=="#next"){
  26. count = parseInt($(this).attr('id')) + 1;
  27. }
  28.  
  29. $('.prev').attr("id", count);
  30. $('.next').attr("id", count);
  31. $(".prev").attr ('href', '#prev');
  32. $(".next").attr ('href', '#next');
  33.  
  34. i = "#" + count;
  35.  
  36. if(count==1){
  37. $(".prev").removeAttr('href');
  38. $(".prev > img").attr('src','Images/photo_left_disable.png');
  39. }else if(count==end){
  40. $(".next").removeAttr('href');
  41. $(".next > img").attr('src','Images/photo_right_disable.png');
  42. }else if(count>1 && count<end){
  43. $(".prev").css('display','block');
  44. $(".next").css('display','block');
  45. $(".prev > img").attr('src','Images/photo_left.png');
  46. $(".next > img").attr('src','Images/photo_right.png');
  47. }
  48.  
  49. var caption = $('img'+i).attr('name');
  50.  
  51. $('#counter').html( count+"/"+end );
  52.  
  53. imgWrapper.hide();
  54.  
  55. $('#propgallery > img').filter(i).fadeIn(500);
  56. $('.caption').html(caption);
  57. }
  58.  
  59. return false;
  60. });
Add Comment
Please, Sign In to add comment