0

I have an svg object in an html page like this

<object id="map" data="img/map_2008.svg" type="image/svg+xml" onload="displayStats();" ></object>

with paths that I would like to attach hoverIntent to. However hoverIntent requires the use of a jQuery selector. How would I go about attaching hoverIntent to all of the paths in the svg document?

1 Answers1

0

attaching directly to an svg on pageload won't work so well, however creative use of the .on() event registration, and selectors for underlying elements of the svg.

javascript

$(function(){
$("#map").on({
  "mouseenter":function(event){},
  "mouseout":function(event){}},"svg element based selector",null);
});

html

<object id="map" data="img/map_2008.svg" type="image/svg+xml" onload="displayStats();" >
  <svg>
   <element>
     <based><selector>hello</selector></based>
   </element>
  </svg>
</object>
DefyGravity
  • 5,681
  • 5
  • 32
  • 47