I have a map with SVG and I am going to create an Area Map with that. It works well when I embed that SVG file in my HTML page, but not when I include it by
This is my SVG:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="595.28px" height="841.89px" viewBox="0 0 595.28 841.89" enable-background="new 0 0 595.28 841.89" xml:space="preserve">
<g id="Layer_1">
<rect x="106.429" y="86.429" fill="#D32A2A" stroke="#000000" stroke-miterlimit="10" width="311.429" height="194.286"/>
</g>
<g id="Layer_2">
<rect x="127.144" y="261.143" fill="#1F5785" stroke="#000000" stroke-miterlimit="10" width="311.428" height="194.287"/>
</g>
</svg>
And this is my javascript:
$(function(){
$('#Layer_2').click(function() {
alert('Thanks');
});
});
This works well and when I click on blue square, an alert shows. DEMO
But I need to include it like this:
<object data="map.svg" type="image/svg+xml" id="map-id" width="100%" height="100%"></object>
and when I include it, I don't have access to that. DEMO