开发者

hover event for raphael

开发者 https://www.devze.com 2023-03-27 14:19 出处:网络
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

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 disappea开发者_Go百科r when the mouse goes over in inner text.

Any hints/ suggestions are welcome


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消