Home arrow JavaScript arrow Page 2 - Applying a Fade Out Effect with the jQuery Tooltip Plug-in
JAVASCRIPT

Applying a Fade Out Effect with the jQuery Tooltip Plug-in


Welcome to the third part of a seven-part series on using the jQuery Tooltip plug-in. In this article, you'll learn how to use the plug-in from this versatile JavaScript framework to create a very cool fadeout effect. It will give your tooltips a more professional appearance.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
October 27, 2009
TABLE OF CONTENTS:
  1. · Applying a Fade Out Effect with the jQuery Tooltip Plug-in
  2. · Review: creating mouse tracking tooltips
  3. · Applying a fade out effect to tooltips
  4. · Varying the duration of the fade out effect

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Applying a Fade Out Effect with the jQuery Tooltip Plug-in - Review: creating mouse tracking tooltips
(Page 2 of 4 )

Before demonstrating how to use the jQuery Tooltip plug-in to create a fade out animation on pop-up notes, it’d be quite instructive to review the examples developed in the preceding article of the series. Those were aimed at illustrating how to utilize the plug-in to build simple mouse tracking tooltips.

That being said, this is how the examples looked originally:

(example on building mouse tracking tooltips)


<!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 with mouse tracking enabled</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

// delay tooltip display 800 ms and track mouse position

$(document).ready(function(){

$("a").tooltip({

delay: 400,

track: true

});

});

</script>

</head>

<body>

<ul>

<li><a href="http://jquery.com" title="Sample Link 1">Sample Link 1</a></li>

<li><a href="http://jquery.com" title="Sample Link 2">Sample Link 2</a></li>

<li><a href="http://jquery.com" title="Sample Link 3">Sample Link 3</a></li>

<li><a href="http://jquery.com" title="Sample Link 4">Sample Link 4</a></li>

<li><a href="http://jquery.com" title="Sample Link 5">Sample Link 5</a></li>

<li><a href="http://jquery.com" title="Sample Link 6">Sample Link 6</a></li>

</ul>

</body>

</html>



(example on building mouse tracking tooltips and URLs are hidden from display)


<!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 that hides URL values</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

// delay tooltip display 400 ms, track mouse position and hide URL

$(document).ready(function(){

$("a").tooltip({

delay: 400,

track: true,

showURL: false

});

});

</script>

</head>

<body>

<ul>

<li><a href="http://jquery.com" title="Sample Link 1">Sample Link 1</a></li>

<li><a href="http://jquery.com" title="Sample Link 2">Sample Link 2</a></li>

<li><a href="http://jquery.com" title="Sample Link 3">Sample Link 3</a></li>

<li><a href="http://jquery.com" title="Sample Link 4">Sample Link 4</a></li>

<li><a href="http://jquery.com" title="Sample Link 5">Sample Link 5</a></li>

<li><a href="http://jquery.com" title="Sample Link 6">Sample Link 6</a></li>

</ul>

</body>

</html>

As shown above, the first example demonstrates how to create a few simple tooltips, which when displayed on screen will be able to follow mouse movements. This will work because the “tooltip()” JavaScript method has been called with a “track: true” input argument. The second example is nearly identical to the first one, except for a subtle difference: an additional “showURL” parameter has been specified, meaning that the tooltips won’t display the “href” attributes assigned to the targeted web page links.

Now that you hopefully recalled the logic that drives the code samples shown previously, it’s time to explore more capabilities offered by the Tooltip plug-in. In the next section I’m going to explain how to create a subtle fade out effect by means of another argument that will be passed to the previous “tooltip()” method. To learn how this will be done, please click on the link below and keep reading.


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 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials