bzy_imageList.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. $(document).ready(function () {
  2. if ($('#totalPage').val() > 0) {
  3. $('.nullData').hide();
  4. $('.pestBtn').show();
  5. $('.delbox .batchesBtn').show();
  6. } else {
  7. $('.nullData').show();
  8. $('.pestBtn').hide();
  9. $('.delbox .batchesBtn').hide();
  10. $('#page').parent().hide();
  11. }
  12. $('.popup-gallery').magnificPopup({
  13. delegate: '.popupA',
  14. type: 'image',
  15. tLoading: 'Loading image ......',
  16. mainClass: 'mfp-img-mobile',
  17. gallery: {
  18. enabled: true,
  19. navigateByImgClick: true,
  20. preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
  21. arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button
  22. tPrev: 'Previous (Left arrow key)', // title for left button
  23. tNext: 'Next (Right arrow key)', // title for right button
  24. tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // 标记的计数器
  25. },
  26. image: {
  27. tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
  28. titleSrc: function (item) {
  29. return item.el.attr('title') + '<small></small>';
  30. }
  31. }
  32. });
  33. // 添加描述
  34. $('.addDetial').magnificPopup({
  35. type: 'inline',
  36. closeOnBgClick:false,
  37. midClick: true,
  38. callbacks: {
  39. open: function () {
  40. // 当前选中项
  41. var item = this.currItem.el[0];
  42. var addr = $(item).parent().find('img').attr('src');
  43. $('#imgPath').val(addr);
  44. $.ajax({
  45. url: 'bzy_describe_img',
  46. type: 'get',
  47. data: {addr: addr },
  48. dataType:'json',
  49. success: function (data) {
  50. if(data){
  51. $('.pupopBody textarea[name="describe"]').val(data);
  52. }
  53. }
  54. })
  55. }
  56. }
  57. });
  58. })
  59. // 自动识别
  60. // function autoSeeWormType(obj){
  61. // var addr = $(obj).parent().find('img').attr('src');
  62. // }