Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Tooltips can greatly improve the usability of your web site by providing direction and cues to visitors. In this course, Chris Converse shows how to convert text or graphics into a mouse-sensitive tooltip. The tutorials demonstrate how to write the necessary HTML and activate the tooltip with jQuery, as well as add positioning and effects.
So inside of the anchor tag, after the href attribute, let's hit a space and the first data item we are going to put in here is going to be data-tip-type, equals, two quotes. We are going to put in the word text. Now we are making up this value, we are going to have two different types, if you remember from the Introduction movie, a text-based tooltip and an html-based tooltip. So after that attribute, but still inside of the anchor tag, let's hit a space.
We are going to type data-tip-source, equals, two quotes, and in here we are going to put the actual text that's going to show up as the tooltip text. So we'll type "This is text for a tooltip." And the last thing we are going to add to this anchor tag is going to be a class; this is how we are going to actually target these items with jQuery.
So lastly we'll add a class attribute, equals, two quotes, and the class is going to be tooltip. Then hit Save. Now we are using a class here because we want to reuse the name tooltip, any number of times on our page, and what's really advantageous about this is we can write one jQuery statement that targets tooltips, and then we are going to come in here and check to see what type of tooltip it is, and then what the actual content is. So now that we have defined an HTML element as having a class of tooltip and having a data tip type, and a data tip source, next we can work on actually finding this object and then modifying the tooltip container based on the data inside of this element.
There are currently no FAQs about Create a Tooltip with jQuery.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.