jQuery click svg -
is there way select svg jquery?. not want manipulate anything. click, img.
(i know external libraries manipulate svg. asking here if possible click jquery , nothing else)
please check answer here:http://jsfiddle.net/nucwg/
html:
<div id="content" > <object data="http://upload.wikimedia.org/wikipedia/commons/3/38/html5_badge.svg" type="image/svg+xml" id="svg"> <img src="grafic.png" alt="bg"> </object> </div>
jquery:
$(function(){ $("#content").click(function() { $("#content").fadeout("normal"); }); })
as cannot bind event object/svg cross domain, trick using kind of hack {using overlay}:
$(function () { var $content = $('#content'), $overlay = $('<div/>').width($content.width()).height($content.height()).css({ position: 'absolute', left: $content.offset().left, top: $content.offset().top }).appendto('body').click(function () { $content.add(this).fadeout("normal"); }); })
Comments
Post a Comment