Disable tooltips using css

后端 未结 10 1017
隐瞒了意图╮
隐瞒了意图╮ 2021-02-12 15:33

Is there a way to disable the tooltips of the tag in css?

10条回答
  •  佛祖请我去吃肉
    2021-02-12 16:24

    You can make it so that the title attribute is removed exclusively on hover, and then re-added. This makes it so that your SEO remains identical, but there is no tooltip text when hovering.

    $('a[title]').on('mouseenter', function () {
       var $this = $(this);
       $this.attr('title-cache', $this.attr('title'));
       $this.attr('title', '');
    });
    
    $('a[title]').on('mouseleave', function () {
       var $this = $(this);
       $this.attr('title', $this.attr('title-cache'));
       $this.attr('title-cache', '');
    });
    

提交回复
热议问题