Advertisement
Guest User

Untitled

a guest
Jun 21st, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. function popup_masonry_gallery() {
  2. ?>
  3. <script type="text/javascript">
  4. (function($){
  5. $(window).load(function(){
  6. $('.av-masonry a.av-masonry-entry.lightbox-added').magnificPopup({
  7. type: 'image',
  8. image: {
  9. titleSrc: false,
  10. markup: '<div class="mfp-figure">'+
  11. '<div class="mfp-close"></div>'+
  12. '<div class="mfp-top-bar">'+
  13. '<div class="mfp-title"></div>'+
  14. '</div>'+
  15. '<div class="mfp-img"></div>'+
  16. '<div class="mfp-bottom-bar">'+
  17. '<div class="mfp-description">'+
  18. '<div class="mfp-alt"></div>'+
  19. '<div class="mfp-caption"></div>'+
  20. '</div>'+
  21. '<div class="mfp-counter"></div>'+
  22. '</div>'+
  23. '</div>',
  24. },
  25. mainClass: 'avia-popup mfp-zoom-in mfp-image-loaded',
  26. closeOnContentClick: false,
  27. midClick: true,
  28.  
  29. gallery: {
  30. enabled: true
  31. },
  32.  
  33. callbacks: {
  34. markupParse: function (template, values, item) {
  35. values.title = item.el.attr('title') !== "" ? '<h2>' + item.el.attr('title') + '</h2>' : '';
  36. },
  37.  
  38. change: function() {
  39. var AltItem = $(this.currItem.el).find('img').attr('alt') !== "" ? $(this.currItem.el).find('img').attr('alt') : '';
  40. var CaptionItem = $(this.currItem.el).find('.av-masonry-entry-content').length > 0 ? $(this.currItem.el).find('.av-masonry-entry-content').html() : '';
  41.  
  42. $(this.content).find('.mfp-alt').html(AltItem);
  43. $(this.content).find('.mfp-caption').html(CaptionItem);
  44. },
  45.  
  46.  
  47.  
  48. /*** if you like to have the arrows inside the container
  49. buildControls: function() {
  50. // re-appends controls inside the main container
  51. this.arrowLeft.appendTo(this.contentContainer);
  52. this.arrowRight.appendTo(this.contentContainer);
  53. },
  54. *** remove these two lines with asterisk ******/
  55.  
  56. },
  57. });
  58. // close the iframe window
  59.  
  60. $(document).on('click', '.popup-modal-dismiss', function (e) {
  61. $.magnificPopup.close();
  62. });
  63. });
  64. })(jQuery);
  65. </script>
  66. <?php }}
  67. add_action('wp_footer', 'popup_masonry_gallery');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement