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
119 views
in Technique[技术] by (71.8m points)

javascript - what is the name of small win that appear by mouse over & how to create it

i want to know the name of small popup window that usually appear by mouse over an object and show some descriptions. for example in the following picture it has appear by mouse over on google search microphone Icon: i mean the windows that show by red arrow

and my next question is how to create this popup windows by java script.

question from:https://stackoverflow.com/questions/65644439/what-is-the-name-of-small-win-that-appear-by-mouse-over-how-to-create-it

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

1 Answer

0 votes
by (71.8m points)

In general

You are looking for the HTML title attribute. This attribute is valid on any HTML element, as mentioned here: https://www.w3schools.com/tags/att_global_title.asp

In HTML

Thus you can add the title attribute to any HTML element. For example:

<a href="#" title="This is your tooltip content">Link</a>

I prepared a jsfiddle for you: https://jsfiddle.net/g2106c9e/

In Javascript

You can assign the title attribute dynamically to any element.

// Get a DOM element
var element = document.getElementById("some-element-id")

// Set this elements title attribute
element.setAttribute("title", "This is your tooltip content")

Here another working jsfiddle: https://jsfiddle.net/p5sLvd63/


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

...