扫码关注官方订阅号
问题1:要设置的是svg原始宽高,不是css宽高哦,截图里是svg打印出来的height属性。目前的做法是改变里面valueAsString属性的值,这样做对吗?
valueAsString
问题2:还有,用js动态生成的绘图命令,怎么应用到path里?
认证0级讲师
var svg = document.getElementById('xx') svg.setAttribute('height', 200) svg.setAttribute('d', 'M1 1 C10 12 11')
原生的方法我还是不会,现在用了Snap.svg的方法:问题1:Snap('.mainSvg').attr('width',414)或者Snap('.mainSvg').attr({'width':414})
Snap.svg
Snap('.mainSvg').attr('width',414)
Snap('.mainSvg').attr({'width':414})
问题2:还是用上面一样的方法,Snap('.mainPath').attr('d','M1 1 C10 12 11 ')
Snap('.mainPath').attr('d','M1 1 C10 12 11 ')
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
原生的方法我还是不会,现在用了
Snap.svg的方法:问题1:
Snap('.mainSvg').attr('width',414)或者Snap('.mainSvg').attr({'width':414})问题2:还是用上面一样的方法,
Snap('.mainPath').attr('d','M1 1 C10 12 11 ')