Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1180272

    How can I hide the alt attribute in the images when I mouse over the image?

    regards

    #1180376

    Hey brunet77,

    You can remove the alt attribute using this code (at it on functions.php):

    function add_custom_tooltip(){
    ?>
    <script>
    jQuery(window).load(function(){
      jQuery('a').removeAttr('alt');
      jQuery('img').removeAttr('alt');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_tooltip');

    If you’re referring to the tooltip that shows on mouse over, please replace alt with title.
    Hope this helps.

    Best regards,
    Nikko

    #1180500

    Sorry, I haven’t explained myself well.
    I do not want to delete it.
    I want to hide it when I mouse over an image.

    I am interested in having the ALT in code, because it is good for SEO.

    I guess by CSS there will be some way.

    Thank you.

    #1180630

    Hi,

    Thanks for the clarification, so you mean the little popup which is generated by the browser? If so then that is not something you can control with code unfortunately, you would have to completely remove it.

    Best regards,
    Rikard

    #1180688

    Hi Rikard:

    I need hide the alt attribute in the images : “KOTAODO – Alivio duradero del dolor de espalda”

    Attach example

    regards

    #1180800

    Hi brunet77,

    Please try this code instead, this should hide the tooltip on image hover:

    function add_custom_tooltip(){
    	?>
    	<script>
    		(function($) {
    			$('img').hover(
    				function () {
    					$(this).data('title',$(this).attr('title')).removeAttr('title');
    				}, 
    				function () {
    					$(this).attr('title',$(this).data('title'));
    				}
    			);
    		})(jQuery);
    	</script>
    	<?php
    }
    add_action('wp_footer', 'add_custom_tooltip', 99);

    Best regards,
    Nikko

    #1180824

    Ok perfect.

    Tnks :D

    #1181038

    Hi brunet77,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.