Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting pointer-events:none with Raphael

Tags:

svg

raphael

I'm using this:

circle.attr({
    fill:'#FFFFFF',
    'stroke-width':0,
    opacity:0,
    'pointer-events':'none'
});

The problem is mouse events are still caught and in the DOM inspector that property does not show.

Thanks.

like image 618
Francisc Avatar asked Dec 05 '25 04:12

Francisc


1 Answers

Raphael has a whitelist of attributes it can assign to an element. Since pointer-events: none is not supported in VML then this property is not among the whitelist. To work around this you can do...

circle.node.setAttribute("pointer-events", "none");

Alternatively, if all circles are non-clickable you can include in your CSS stylesheet:

circle {
   pointer-events: none;
}

However, none of this will work in any browser that is IE8 or less. If you need old IE support please check out this answer: pointer-events: none VML raphael solution

like image 87
methodofaction Avatar answered Dec 09 '25 14:12

methodofaction



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!