javascript - jQuery attr() fails to set attribute -
i trying rotate image via svg's transform. code have:
<svg width="100" height="100"> <image id="trns" transform="rotate(90,50,50)" width="100" height="100" xlink:href="logo.png"/> </svg> this rotates logo.png 90 degrees when page loads. also, when change 90 different number in firbug's html tab rotation changes accordingly. when try change value jquery, nothing happens:
$('#trns').attr('transform', 'rotate(60, 50,50)'); what firebug attr line not?
working fine here (with jquery 1.6.2): http://jsfiddle.net/niklasvh/k3grd/
make sure call once dom ready:
$(function(){ $('#trns').attr('transform', 'rotate(60,50,50)'); });
Comments
Post a Comment