Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2012
    Posts
    137
    Thanks
    1
    Thanked 1 Time in 1 Post

    Is there a better way to capture mouse

    So I am capturing the mouse X and Y positions like this:
    Code:
    $(document).ready(function(){
    $(document).mousemove(function(e){
    	 mouseX = e.pageX
      });
    });
    And then later, when a user hovers over a link, I want to have a tool tip show up near their cursor.

    My question is; Is there a better way to capture the mouse position other than constantly listening for the mouse move? Can I add the mouseMove listener to the link in question?

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    There is a library for tooltips called "overLib" that you can set it so that the tooltip follows the mouse around. Much simpler.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    i find it more consistent to inject the tooptip next to the link, so that they share a parent.
    i can then use simple relative positioning CSS to show the tip.

    with absolute positioning, you have to wrorry about scrolling, zoom, container display mode, and edge of viewport issues, but with simple toggled sibling content, it's magically in the right place every time.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •