javascript - How to target hover effect with Snap.SVG? -
i'm testing animations snap.svg on hover in/out , on click svg illustration created , exported illustrator.
i have group includes others sub-groups. on hovering parent group, child groups animated snap. problem hover event triggers on entering parent group, hover out triggers when hovering children groups, resulting animation stop, or start again, or going initial state.
the structure of svg groups following :
--the 'renard' group
----the 'tete' groupe
----the 'bras_gauche' group
----the 'bras_droit' group
----the 'queue' group
i tried using elm.attr({pointerevents: "none" });
(see here) doesn't work. desactivate totally hover triggering on parent group.
the result here : http://codepen.io/hugo8705/pen/zgvxpl
i achieved desired effect using transparent rectangular hotspot above fox, hotspot doesn't fits fox shape : http://codepen.io/hugo8705/pen/zgdyox
i hope it's clear enough, don't know how fix problem. maybe it's configuration of mark that's not good.
thank help,
hugo
pointer-events isn't svg attribute. try css styling on of sub elements.
so instead of elem.attr({ pointerevents: "none" });
try create css style pointer-events: none each of sub groups, eg
#tete, #bras_gauche etc { pointer-events: none; }
Comments
Post a Comment