Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Developer and personalized recommendations.Start Your Free Trial Now
- View Offline
- Saving web graphics from Photoshop
- Creating the tooltip container
- Adding the jQuery $(document).ready() and mouse events
- Detecting and setting HTML-based tooltips
- Attaching the tip container to the mouse
- Setting the tooltip to fade in and out
- Accounting for other CSS-positioned elements
Skill Level Intermediate
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.