Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #965907

    Hi

    I have this code in my child theme to stop the alt tags appearing on hover on images

    /* Remove image titles that show up when you hover on images */
    function remove_title_attr(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘#wrap_all a’).removeAttr(‘title’);
    jQuery(‘#wrap_all img’).removeAttr(‘title’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘remove_title_attr’);
    /* END Remove image titles that show up when you hover on images */

    It works fine but it also seems to stop the alt tag displaying in a lightbox for galleries.
    Specifically I have a page here

    where I would like to display the alt tag below the image in the masonry gallery lightbox.
    Is it possible I could enable this just for one page or gallery?

    Also I noticed that for the masonry gallery the alt tag is not in the code for the images. Is that right?

    Thanks
    Su

    #965917

    Hey Sujohn,
    I changed your script to have it not effect your gallery:

    /* Remove image titles that show up when you hover on images */
    function remove_title_attr(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('#wrap_all a.avia_image').removeAttr('title');
    jQuery('#wrap_all img.avia_image').removeAttr('title');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'remove_title_attr');
    /* END Remove image titles that show up when you hover on images */

    Please clear your browser cache and check.

    Best regards,
    Mike

    #966655

    Brilliant.
    Thanks So Much.
    Su

    #966691

    Hi,

    I’m glad you were able to get this corrected. If you need additional help please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Lightbox display alt tag below image’ is closed to new replies.