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 this is jQuery's document ready structure. So these instructions won't run until the HTML file has been loaded. So inside of the document ready, the first thing we want to do once the HTML has been loaded is target the tooltip and set the mouse events. So I am going to start with a $(), two tick marks inside for a string literal, we are going to search for .tooltip. This is going to target every HTML element in our page that has a tooltip, so we can have more than one on the page. Outside of the parentheses .mouseover, beginning and ending parentheses, outside of the parentheses we are going to type .mousemove, another set of parentheses, outside of those parentheses .mouseout, then a semicolon.
So we are attaching three properties onto the tooltip, mouseover, mousemove and mouseout. Inside of each one of these parentheses, we're going to actually target the mouse event itself. So inside of each one of these parentheses, we're going to put a custom function that targets the actual event. So we are going to type function(), inside of the parentheses, we are going to put letter e, outside of the parentheses, but still inside of the parentheses for mouseover, we are going to put beginning and ending bracket.
I am going to select this first one here, let's come over here and paste this inside of each of the parentheses for mousemove and mouseout. Once we have all of these in place, let's come over here and just split these open, split each one open on the brackets, just close up some negative space. So now we have an area to put instructions in for mouseover, for mousemove and mouseout, and we'll start that in the next movie.
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.