Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable tooltips using css

Tags:

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

like image 267
Varada Avatar asked Apr 23 '11 04:04

Varada


People also ask

How do I get the disabled tooltip button?

By default, tooltips will not be displayed on disabled elements. However, you can enable this behavior by using the following steps: Add a disabled element like the button element into a div whose display style is set to inline-block . Set the pointer event as none for the disabled element (button) through CSS.


2 Answers

I don't know what is your reason for wanting to disable tool-tips but I've run into the same problem myself.

I was trying to create a bubble tool-tip in CSS but the browser tool-tip would always appear and mess things up. So, like you, I needed to disable the default tool-tip.

I used a bit of jQuery to remove the "Title" tag but only on mouse hover. As soon as the mouse is out, the "Title" tag is restored.

Following is a DIV with some "Title" content:

<div class="tooltip-class" title="This is some information for our tooltip.">
  This is a test
</div>

Now, you will have to run the following jQuery to hide the Title tag on mouse hover:

$(document).ready(function(){
  $(".tooltip-class").hover(function(){
    $(this).attr("tooltip-data", $(this).attr("title"));
    $(this).removeAttr("title");
  }, function(){
    $(this).attr("title", $(this).attr("tooltip-data"));
    $(this).removeAttr("tooltip-data");
  });
});

Note that this jQuery code was tested in an environment with jQuery Version 1.6.4.

Following is a link to the full example:

http://jsfiddle.net/eliasb/emG6E/54/

like image 136
DrupalFever Avatar answered Sep 22 '22 09:09

DrupalFever


I know this is an old question, but in the meantime this has become possible via CSS like this:

pointer-events: none;

Note however that this also disabled the clicking ability! It was what I needed, but may not be the case for the OP.

cfr https://developer.mozilla.org/en/docs/Web/CSS/pointer-events

like image 25
Steven De Groote Avatar answered Sep 18 '22 09:09

Steven De Groote