Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2013, 07:59 PM   PM User | #1
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
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?
m2244 is offline   Reply With Quote
Old 02-11-2013, 08:06 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 950
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
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".
WolfShade is offline   Reply With Quote
Old 02-12-2013, 03:43 PM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:24 AM.


Advertisement
Log in to turn off these ads.