LeaVerou / prefixfree

Break free from CSS prefix hell!
http://projects.verou.me/prefixfree/
MIT License
3.83k stars 712 forks source link

setAttribute for style #6121

Closed EasonWang01 closed 8 years ago

EasonWang01 commented 8 years ago

hi,this is not related for this repo,

If I want to using setAttribute like

<g transform='translate(640 105) rotate(30)'  style="position:absolute;left:450px"  id="layer1">
x=25;
document.getElementById('layer1').setAttribute('transform','rotate('+x+')');

But the translate(640 105) will be overwrite,how to update the rotate attribute without overwrite other style in transform attribute?

thanks for reply.

LeaVerou commented 8 years ago

Closing, as this is not a CSS help forum. Try stack overflow. In addition, I'd try to answer your question, but I cannot understand what you're asking. Use getAttribute() to get the current transform and then string.replace() to modify it?

EasonWang01 commented 8 years ago

thanks!