kavita
kavita

Reputation: 13

hover event for raphael

I have a rect object with a text on it. For this i have used a set. I want to implement a hover event (i.e. mouseEnter as well as mouseLeave). My problem is that since the text is on the rect hovering over the text triggers a mouseLeave event for the rect and so my hover functionality goes for a toss.It is imperative that i use Raphael in my code. Can someone suggest a way for implemnting the hover for the rect which does not disappear when the mouse goes over in inner text.

Any hints/ suggestions are welcome

Upvotes: 1

Views: 505

Answers (2)

Scott
Scott

Reputation: 21

if the text is not requiring some special functionality, then just put the hover on the set and not directly on the rect

Upvotes: 2

Femi
Femi

Reputation: 64710

I'd suggest making the hover exit code use setTimeout and save the value to a variable, and then using the same hover enter/exit function for all members of the set. In the hover enter, check if the variable is set and if it is cancel it. That way if the mouse moves from one member of the set to the other then the hover exit gets called (queuing up the functionality) and then the same hover enter gets called, disabling the exit code. If the mouse moves entirely off the set, then the timer fires and everything works as intended.

Upvotes: 1

Related Questions