Is it possible to hide title when hovering image?

后端 未结 8 949
长情又很酷
长情又很酷 2020-12-21 18:30

This is my code:

\"\"

When I hover that image \"some title\" appears. Is it possib

8条回答
  •  长情又很酷
    2020-12-21 18:47

    Yes! with jQuery you can remove it on mouseover and add it again onmouseout -

    $(function(){
      var ttext;
      $('img').hover(function(){
        ttext = $(this).attr('title');
        $(this).removeAttr('title');
      },
      function(){
        $(this).attr('title', ttext);
      });
    });
    

提交回复
热议问题