Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Combustion

Mouse follow tooltip on rollover

Recommended Posts

Hi, 

 

Can someone help me with this? I want it so when you roll over #box the tooltip (or ball in this case) appears and follows the mouse. When you roll out of #box the tooltip will fade away.

 

This is where I am so far:

 

See the Pen IguFo by hrk (@hrk) on CodePen

 

Any ideas on how to do this?

Thanks

Link to comment
Share on other sites

Hi,

 

It appears #box is the tooltip and #button is the thing you want to rollover to trigger the tooltip, correct?

 

You can just add mouseenter and mouseleave events to #button that hide or show the #box.

 

The problem is that the #box will sit on top of #button when the mouse is over #button, and that triggers a mouseleave on the #button. There is a little css that you can put on #box that helps get around this

 

pointer-events:none;

 

see example here:

See the Pen 38079ce0aa948201258cf16381b0073f by GreenSock (@GreenSock) on CodePen

 

You could also offset the #box x and y values so that the tooltip is never directly layered between the mouse and the #button.

  • Like 1
Link to comment
Share on other sites

Hi, thanks great thanks. I'll move the tooltip so the mouse never goes over it so i can use the pointer icon.

 

Cheers

Link to comment
Share on other sites

If your tooltip is not directly under the mouse that would work best.

 

While pointer-events is very useful, it has no effect on any version of Internet Explorer. http://caniuse.com/pointer-events.


http://www.vinylfox.com/forwarding-mouse-events-through-layers/ offers a solution that would also work on IE.

Link to comment
Share on other sites

Thanks Jamie. I appreciate the tip!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×