@Mukyuu helpfully flagged a duplicate question, but it is quite old and the correct answer in 2019 may be very different. For instance, @Andy Hoffman has suggested a workaround that was not viable years ago.
This question is similar, but not the same.
Our web page contains multiple tooltips. There's a noticeable 1-2 second lag before the first tooltip appears (on Chrome). After this first one appears, subsequent tooltips appear nearly instantly as you hover over other elements.
To be clear, tooltip refers to the value in the title
attribute of an element like this:
<input type="button" title="Click" value="My Button">
Is there a way to make all tooltips appear instantly?
It's set on 5 seconds. Instead add the data-trigger='manual' attribute to each of elements, we can add option in initialisation script:'$(document). ready(function() { $('[data-toggle="tooltip"]'). tooltip({ trigger:'hover manual', //...})})'
There's no way to disable the default browser behaviour, which is to show the title attribute as a "tooltip" in the browser itself. You'll need to resort to some javascript, it could even be as simple as setting the title to blank on hover, and replacing it on mouse out....
HTML title Attribute The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element. The title attribute can be used on any HTML element (it will validate on any HTML element.
You can use an element's pseudo content to display a tooltip on hover. Note, pseudo content does not work with input
s but does work with button
, as in the following example.
.my-button {
position: relative;
}
.my-button:hover::after {
position: absolute;
content: attr(data-tooltip);
bottom: -2.5em;
right: -1em;
background-color: #333;
color: white;
padding: .25em .5em;
}
<input type="button" title="Click" value="My Button">
<button class="my-button" data-tooltip="Click">My Button</button>
Update
As a workaround for input
, include a wrapper div
, and use the data attribute of that div
instead of the child input
.
.input-wrapper {
position: relative;
display: inline-block;
}
.input-wrapper:hover::after {
position: absolute;
content: attr(data-tooltip);
bottom: -2.5em;
right: -1em;
background-color: #333;
color: white;
padding: .25em .5em;
font-size: .8em;
}
<div class="input-wrapper" data-tooltip="Click">
<input type="button" value="My Button">
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With