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

    hi
    I am trying to hide the tooltips on image hover but keep the titles in the lightbox active.
    I’ve tried this code in functions.php

    /* Remove tooltips from images on hover */
    
    function add_custom_tooltip(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('a').removeAttr('title');
    jQuery('img').removeAttr('title');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_tooltip');

    but that only hidethe titles and not the tooltips.

    and this in css:

    .avia-tooltip {
    	display: none!important;
    }

    that did nothing.

    any advice on how to do this?
    thanks
    Nancy

    • This topic was modified 2 years, 2 months ago by Munford.
    • This topic was modified 2 years, 2 months ago by Munford.
    #1367505

    Hi Munford,

    Please try adding this PHP code in your functions.php (child theme):

    function remove_title(){
    ?>
    <script>
    (function () {
        function removeTitle(el) {
            el.removeAttribute('title');
        }
    
        const items = document.querySelectorAll('#top .isotope-item');
        const containers = document.querySelectorAll('#top .isotope-item .av-masonry-image-container');
        
        items.forEach(removeTitle);
        containers.forEach(removeTitle);
    })();    
    </script>
    <?php
    }
    
    add_action('wp_footer', 'remove_title');

    Hope it helps.

    Best regards,
    Nikko

    #1367533

    hi thanks that worked fine!

    • This reply was modified 2 years, 2 months ago by Munford.
    #1367620

    Hi,
    Glad Nikko was able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘disable tooltip, keep titles on masonry gallery’ is closed to new replies.