EduardET

Add image caption to the magic popup layout - updated

Nov 16th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         $( window ).bind( "load", function() {
  5.             var galleryItem = $( ".et_pb_gallery_item" );
  6.             galleryItem.each( function() {
  7.                 var captionText = $( this ).find( ".et_pb_gallery_caption" ).text(),
  8.                     trigger = $( this ).find( "a" );
  9.                 trigger.click( function() {
  10.                     setTimeout( function() {
  11.                         var previewTitle = $( ".mfp-title" ).text();
  12.                         $( ".mfp-title" ).text( previewTitle + ": " + captionText );
  13.                     }, 100 )
  14.  
  15.                 } )
  16.             } )
  17.         } );
  18.     } );
  19. } )( jQuery );
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment