javascript - lagging mouse bahavior on SVG -


this question has answer here:

i'm working on tooth selection menu web-app i'm building. found svg , i'm modifying it.

i tried simplify mouse behavior, making large areas hoverable ('.parent') , other stuff {pointer-events:none}. however, there's major lag. when move mouse 1 of teeth, doesn't respond. when moving it.

do see also? can do?

 $('.parent').mouseover(function(){   $(this).css('fill', 'red'); });  $('.parent').mouseleave(function(){   $(this).css('fill', 'none'); }); 

link codepen playground

a simple change in css fixed issue:

svg *{   pointer-events: none; // disable pointer-events elements inside svg } svg .parent{   pointer-events: all; // enable pointer-events on elements } 

here's updated version of codepen: https://codepen.io/etiennemartin/pen/yovzzb

i changed way trigger mouseover, that's personal preference. looks cleaner me.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -