Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Solution: Tooltips

From: Up and Running with Bootstrap 3

Video: Solution: Tooltips

All right, so how'd you do? What did you think of those Tooltips? I'm taking a look at file 05_05, which comes from the exercise files folder, just copy that HTML in to your Bootstrap folder and pull it up here in the browser. And this is my solution, so down here at the bottom of the page we have all of our read more buttons. As you roll your mouse over these you'll see a little Tooltip that comes up. It's not terribly helpful I don't think in terms of user experience, I'm not sure that these Tooltips do a lot but hey, we've got Tooltips on this page and you can at least see how they work.

Solution: Tooltips

All right, so how'd you do? What did you think of those Tooltips? I'm taking a look at file 05_05, which comes from the exercise files folder, just copy that HTML in to your Bootstrap folder and pull it up here in the browser. And this is my solution, so down here at the bottom of the page we have all of our read more buttons. As you roll your mouse over these you'll see a little Tooltip that comes up. It's not terribly helpful I don't think in terms of user experience, I'm not sure that these Tooltips do a lot but hey, we've got Tooltips on this page and you can at least see how they work.

So, how exactly did I manage to get this to work? Well, that's over in our HTML. And if you scroll on down the page here, on down to the bottom, say around line 74, this is the line of code that's calling for the read more button. And you'll see that I've added two things here to make this Tooltip happen. What is the data hyphen toggle equals Tooltip? Remember data hyphen anything has to do with JavaScripts so we've bound the JavaScript here to this link and that's going to make the Tooltip magic happen. And I've also added a title attribute.

Now the title attribute is something that's an HTML standard. You can add a title attribute to pretty much any HTML tag at all. And in Firefox at least when you roll your mouse over something it'll come up as a little browser-driven Tooltip, but what Bootstrap is doing is adding some styling to that browser-driven Tooltip to make it look really pretty. So, as you see here, the title of that is read more about vaccines, so that's where that text is coming from. If you just do this much, though. And you try putting this in your browser. You're going to see, especially if you're using Firefox.

You're just going to see little bits of the words. But they're not going to be styled with the little black bubble, the way that you saw in the example. The trick to getting all of that work is down, further down the page here. Down here in the script portion of this. So I've added a call to JavaScript. What you have to do with these Tooltips is, you have to initialize them. And the reason why is, you don't want JavaScript spending all its time listening to every single HTML element in your webpage just in case anyone ever happened to roll their mouse over it.

And in case there ever happened to be a Tooltip associated with it. It just takes up a lot of processing power and makes your page run slow and all kinds of other things. So it's a good practice to tell JavaScript that there's Tooltips associated with certain elements on your page but not every element on your page. And then of course you have to tell JavaScript which elements those are. What happens to be is that those buttons all have something in common. And the A tag in each of those has the same classes, one of which is BTN-info. So I chose as my selector here A.Button-info.

So in other words, an A tag with a class of button-info.Tooltip. This is what initializes the JavaScript. So, anytime the mouse is going to roll over one of those links, that happens to have a class of button-info, the Tooltip JavaScript is going to run, and see if there a need to display a Tooltip for that particular item. So, that's how this is all set up, and how it's working together to make the magic happen. So, I hope that you get Tooltips working on your page. Maybe you tried a few experiments with some of the other attributes associated with Tooltips.

It's a pretty handy little feature that you might find useful on your next website.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 3
Up and Running with Bootstrap 3

37 video lessons · 27990 viewers

Jen Kramer
Author

 
Expand all | Collapse all
  1. 5m 25s
    1. Welcome
      58s
    2. Using the exercise files
      1m 19s
    3. Installing Sublime Text 2
      3m 8s
  2. 29m 0s
    1. What is Bootstrap?
      8m 1s
    2. Downloading and unzipping Bootstrap 3
      4m 31s
    3. Examining Bootstrap file structure
      4m 34s
    4. Adding CSS to a Bootstrap HTML file
      4m 35s
    5. Adding JavaScript to a Bootstrap HTML file
      7m 19s
  3. 44m 38s
    1. Exploring Bootstrap's grid system
      9m 10s
    2. Creating new rows and cells
      14m 5s
    3. Adjusting column widths using offset
      5m 2s
    4. Changing column order using push and pull
      5m 34s
    5. Nesting columns
      3m 43s
    6. Creating a JumboTron-style layout
      3m 41s
    7. Challenge: Working with grids
      1m 31s
    8. Solution: Working with grids
      1m 52s
  4. 53m 34s
    1. Exploring basic typography: The small and blockquote tags
      4m 29s
    2. Exploring Bootstrap's responsive classes including .hidden and .visible
      4m 44s
    3. Styling buttons using btn classes
      4m 43s
    4. Styling images with responsiveness and decorative touches
      5m 22s
    5. Incorporating Bootstrap 3 glyph icons
      3m 28s
    6. Creating a thumbnail gallery
      6m 2s
    7. Styling tabular data
      5m 3s
    8. Overriding core CSS with custom styles
      12m 53s
    9. Challenge: Styling panels and callouts
      2m 17s
    10. Solution: Styling panels and callouts
      4m 33s
  5. 27m 41s
    1. Implementing location breadcrumbs
      6m 38s
    2. Using tabs and pills for navigation
      6m 58s
    3. Developing a responsive navigation bar
      9m 9s
    4. Challenge: Modify the "pancake" button
      1m 3s
    5. Solution: Modify the "pancake" button
      3m 53s
  6. 37m 45s
    1. Implementing dropdowns within a navigation bar
      5m 5s
    2. Tabbing within the same page
      15m 45s
    3. Accordion panels with collapse functionality
      11m 37s
    4. Challenge: Tooltips
      1m 59s
    5. Solution: Tooltips
      3m 19s
  7. 3m 0s
    1. Next steps towards advanced Bootstrap
      3m 0s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 3.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.