EduardET

Add image caption to the magic popup layout

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