JavaScript
  Home arrow JavaScript arrow Page 2 - Tracking Mouse Movements with the jQuery T...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Tracking Mouse Movements with the jQuery Tooltip Plug-in
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-10-26

    Table of Contents:
  • Tracking Mouse Movements with the jQuery Tooltip Plug-in
  • Review: adding default tooltips to web page links
  • Tracking mouse movements
  • Hiding URL values from display with the showURL input argument

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Tracking Mouse Movements with the jQuery Tooltip Plug-in - Review: adding default tooltips to web page links


    (Page 2 of 4 )

    In case that you still haven't read the introductory article of this series, where I explained how to add basic tooltips to a group of bulleted web page links, below I listed the code samples that illustrate how to accomplish this process in a effortless fashion. Here they are:

    (example on adding a default tooltip to web page links)


    <!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 basic example</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

    $(document).ready(function(){

    $("a").tooltip();

    });

    </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 adding a default tooltip to web page links using a delay argument)


    <!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 using a delay parameter</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

    // specify a 800 ms delay for tooltip to be displayed

    $(document).ready(function(){

    $("a").tooltip({

    delay: 800

    });

    });

    </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 illustrated by the two code samples above, adding a basic tooltip to a group of web page links is a straightforward process that can be tackled with only minor hassles. The first case shows how to do this by calling the "tooltip()" method with no input arguments, while the second example demonstrates how to delay the display of the tooltip by passing a "delay" argument to the method in question.

    So far, everything looks simple to digest, right? At this point, you should have an appropriate idea of how to attach basic tooltips to certain elements on a web page. Even so, I'm only scratching the surface when it comes to working with the jQuery Tooltip plug-in, because it's really easy to enhance its default behavior.

    You may be wondering if it's possible to make tooltips follow mouse movements. Yes, absolutely. And in the following section I'm going to explain how to achieve this by means of yet another incoming argument that will be passed to the "tooltip()" JavaScript method that you saw before.

    To learn how to provide tooltips with the ability to track mouse positions, click on the link shown below and read the next few lines.

    More JavaScript Articles
    More By Alejandro Gervasio


       · This second part of the series shows you how to enhance the default tooltip built in...
     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek