Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
538 views
in Technique[技术] by (71.8m points)

javascript - Make title attribute appear instantly on hover

is there a possibility to make a title attribute of an anchor tag appear instantly on mouseover not just after seconds. Any solution in JavaScript/jQuery and CSS is good.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The handling of the title attribute is browser-dependent, and no APIs have been defined to control it, still less specified in specs. This includes the delay, the duration of the display, the font used, font size, etc.

There are other techniques that can be used instead of the title attribute. Some of them have been mentioned in other answers. Note that simple “CSS tooltips” can be implemented in pure CSS rather simply and flexibly. When using these techniques, the data to be shown is usually not in a title attribute, since its handling is browser-dependent, so there would be a risk of having your special tooltip display and a browser’s implementation of title. Though it is possible to prevent the latter, when scripting is enabled, it is simpler to use an attribute that has no default effect on anything, such as data-title=... or data-tooltip=....


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...