Home arrow JavaScript arrow Page 4 - More Uses for the jQuery Tooltip Plug-in`s bodyHandler Option
JAVASCRIPT

More Uses for the jQuery Tooltip Plug-in`s bodyHandler Option


Welcome to the final installment of a series on the jQuery Tooltip plug-in. In seven approachable tutorials, this series shows you how to use this powerful JavaScript application to create all sorts of eye-popping tooltips for your web page links. This will make them much more accessible and usable to your potential visitors.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
November 04, 2009
TABLE OF CONTENTS:
  1. · More Uses for the jQuery Tooltip Plug-in`s bodyHandler Option
  2. · Review: building an image tooltip
  3. · Assigning different coordinates to the image-based tooltip
  4. · Building a tooltip application with the fade out effect disabled

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
More Uses for the jQuery Tooltip Plug-in`s bodyHandler Option - Building a tooltip application with the fade out effect disabled
(Page 4 of 4 )

I’d like to end this last article of the series by showing you how to build yet another tooltip application that displays the full-sized version of the sample image that you saw before, but in this case the tooltip won’t fade out smoothly. Indeed, the  “fade” option won’t be passed to the corresponding “tooltip()” method.

That being said, please examine the source code of this last hands-on example, which looks like this:  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Tooltip Example 1</title>

<link rel="stylesheet" type="text/css" href="jquery.tooltip.css" />

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript" src="jquery.dimensions.js"></script>

<script type="text/javascript" src="jquery.tooltip.js"></script>

<script type="text/javascript">

// assign tooltip to links after web page has been loaded

// tooltip delay 800 ms, use top and left coordinates with fade disabled

$(document).ready(function(){

$("img").tooltip({

delay: 800,

track: true,

top: 10,

left: 40,

bodyHandler: function() {

return $("<img />").attr("src", this.src);

}

});

});

</script>

</head>

<body>

<img src="sample_image.gif" width="125" height="100" alt="Sample Image" />

</body>

</html>

Undoubtedly, the above sample tooltip application looks very similar to others developed previously, with a slight difference: the tooltip will be hidden from display abruptly, since the “fade” argument hasn’t been passed to the “tooltip()” method. Of course, the best way to understand how this application works is by trying it out on your own browser, so I encourage you to do that.

Also, feel free to edit all of the code samples included in all the articles that comprise this series. This will help you to acquire a more solid background in using the handy jQuery Tooltip plug-in. No matter what you do, one thing is certain: you’ll have a great time working with it!

Final thoughts

We’ve come to the end of this series. But there’s no reason to feel down actually, since in this group of articles, you learned how to incorporate professional-looking tooltips into some web page links by using the excellent jQuery Tooltip plug-in.

As you saw for yourself in all of the code samples developed in this series, the plug-in is extremely easy to configure and use, and offers a good level of customization. If you’re planning to add a killer feature to your web site, the Tooltip plug-in is definitely a good option to consider.

See you in the next web development tutorial!


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials