admin管理员组文章数量:1022794
I'm using Raphael js framework to create interactive svg image on client:
var paper = Raphael(document.getElementById("svgcontainer"));
var path = paper.path("M0,0 L150,0 L150,150, L0,150 Z");
path.attr({fill: 'red'});
var text = paper.text(40,20, "some text");
path.mouseover(function(){this.attr({fill: 'green'})});
path.mouseout(function(){this.attr({fill: 'red'})});
Please look at jsfiddle example /
If the user moves the mouse over the text inside the path
element, the path
element will trigger mouseout
event. How to prevent triggering of mouseout event on path
element when user moves mouse to text element?
I'm using Raphael js framework to create interactive svg image on client:
var paper = Raphael(document.getElementById("svgcontainer"));
var path = paper.path("M0,0 L150,0 L150,150, L0,150 Z");
path.attr({fill: 'red'});
var text = paper.text(40,20, "some text");
path.mouseover(function(){this.attr({fill: 'green'})});
path.mouseout(function(){this.attr({fill: 'red'})});
Please look at jsfiddle example http://jsfiddle/6BtUk/9/
If the user moves the mouse over the text inside the path
element, the path
element will trigger mouseout
event. How to prevent triggering of mouseout event on path
element when user moves mouse to text element?
1 Answer
Reset to default 4I haven't worked with Raphael but it looks like you can try using Set to group your label and the rectangle and attach the event handler to the set.
jsfiddle
Here is another question that is similar to yours
Raphael JS : mouseover/mouseout - problem with text-labels
I'm using Raphael js framework to create interactive svg image on client:
var paper = Raphael(document.getElementById("svgcontainer"));
var path = paper.path("M0,0 L150,0 L150,150, L0,150 Z");
path.attr({fill: 'red'});
var text = paper.text(40,20, "some text");
path.mouseover(function(){this.attr({fill: 'green'})});
path.mouseout(function(){this.attr({fill: 'red'})});
Please look at jsfiddle example /
If the user moves the mouse over the text inside the path
element, the path
element will trigger mouseout
event. How to prevent triggering of mouseout event on path
element when user moves mouse to text element?
I'm using Raphael js framework to create interactive svg image on client:
var paper = Raphael(document.getElementById("svgcontainer"));
var path = paper.path("M0,0 L150,0 L150,150, L0,150 Z");
path.attr({fill: 'red'});
var text = paper.text(40,20, "some text");
path.mouseover(function(){this.attr({fill: 'green'})});
path.mouseout(function(){this.attr({fill: 'red'})});
Please look at jsfiddle example http://jsfiddle/6BtUk/9/
If the user moves the mouse over the text inside the path
element, the path
element will trigger mouseout
event. How to prevent triggering of mouseout event on path
element when user moves mouse to text element?
1 Answer
Reset to default 4I haven't worked with Raphael but it looks like you can try using Set to group your label and the rectangle and attach the event handler to the set.
jsfiddle
Here is another question that is similar to yours
Raphael JS : mouseover/mouseout - problem with text-labels
本文标签: javascriptSVGhow to properly handle mouseover and mouseout eventStack Overflow
版权声明:本文标题:javascript - SVG : how to properly handle mouseover and mouseout event? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745575997a2157019.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论