Tagged: Masonry Gallery
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
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
hi thanks that worked fine!
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