Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1474724

    Hello
    Is it a possibility to add custom CSS to hide image title on hover ?
    I have no child theme but some custom CSS in WordPress (saved for update theme)
    Thank you

    #1474725

    Hey Renaud,
    If you are not using a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
    use wpcode php snippet and activate
    and ensure that it is activated, then add this code and save.

    function custom_script() { ?>
      <script>
    (function($){
      $('img').hover(function(e){
          $(this).attr('data-title', $(this).attr('title'));
          $(this).removeAttr('title');
      },
      function(e){
          $(this).attr('title', $(this).attr('data-title'));
      }); 
      $('.av-masonry-image-container').hover(function(e){
          $(this).attr('data-title', $(this).attr('title'));
          $(this).removeAttr('title');
      },
      function(e){
          $(this).attr('title', $(this).attr('data-title'));
      }); 
      $('a').hover(function(e){
          $(this).attr('data-title', $(this).attr('title'));
          $(this).removeAttr('title');
      },
      function(e){
          $(this).attr('title', $(this).attr('data-title'));
      }); 
    })(jQuery);
    </script>
      <?php
    }
    add_action( 'wp_footer', 'custom_script', 99 );

    Best regards,
    Mike

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