1. SVG背景透明的解决办法 IE中,完全可以支持SVG透明。
条件:使用标签 (自己测试的,其他标签未知)Tip: Internet Explorer supports an additional attribute, wmode=\"transparent\ that let the HTML page background shine through.tip:ie浏览器支持一个附加的属性,wmode=\"transparent\",用来使html背景透明。 -------来自W3C Schools SVG教程。 2.SVG中文显示首先要注意的是字体问题要在svgviewer中显示中文字体,需要将中文字体名称进行“国际化”,即将汉字字体名称改为英文名称,如将“宋体”改为“Simsun\",“黑体”改为\"Simhei\"等,下面是部分字体对照列表: English Name Localized Name SimSun 宋体 SimHei 黑体FangSong_GB2312 仿宋_GB2312 KaiTi_GB2312 楷体_GB2312 YouYuan 幼圆 STSong 华文宋体 STZhongsong 华文中宋 STKaiti 华文楷体 STFangsong 华文仿宋 STXihei 华文细黑 STLiti 华文隶书 STXingkai 华文行楷STXinwei 华文新魏 STHupo 华文琥珀 STCaiyun 华文彩云 FZYaoTi 方正姚体简体 FZShuTi 方正舒体简体 NSimSun 新宋体 LiSu 隶书其次要注意文件编码问题:将svg文件保存的时候要选择utf-8编码或者unicode编码,当然svg文件的encoding属性也应该是\"utf-8\" 3.判断鼠标事件来源在SVG中会经常遇到判断鼠标事件来源的问题,比如:鼠标单击或者双击、滚轮事件等等。这里做一个简单的介绍。判断鼠标是左键还是右键?在onclick事件中,if(evt.button==0)则为左击,否则为右击 无论单击还是双击evt.detail==1 判断鼠标是单击还是双击?在onclick事件中,if(evt.detail==2)则为双击,否则为单击 判断鼠标的滚轮事件?function mousewheel() {origscale=root.currentScale;origscale +=event.wheelDelta / 1200; if (origscale > 0) {root.currentScale=origscale;root.currentTranslate.x=midx*root.currentScale+event.offsetX*(1-root.currentScale/midscale);root.currentTranslate.y=midy*root.currentScale+event.offsetY*(1-root.currentScale/midscale);midscale=root.currentScale;midx=root.currentTranslate.x/root.currentScale; midy=root.currentTranslate.y/root.currentScale; } }4. SVG自适应高度和宽度
Tip: Internet Explorer supports an additional attribute, wmode=\"transparent\ that let the HTML page background shine through.
tip:ie浏览器支持一个附加的属性,wmode=\"transparent\",用来使html背景透明。 -------来自W3C Schools SVG教程。
2.SVG中文显示
首先要注意的是字体问题
要在svgviewer中显示中文字体,需要将中文字体名称进行“国际化”,即将汉字字体名称改为英文名称,
如将“宋体”改为“Simsun\",“黑体”改为\"Simhei\"等,下面是部分字体对照列表: English Name Localized Name SimSun 宋体 SimHei 黑体
FangSong_GB2312 仿宋_GB2312 KaiTi_GB2312 楷体_GB2312 YouYuan 幼圆 STSong 华文宋体 STZhongsong 华文中宋 STKaiti 华文楷体 STFangsong 华文仿宋 STXihei 华文细黑 STLiti 华文隶书 STXingkai 华文行楷
STXinwei 华文新魏 STHupo 华文琥珀 STCaiyun 华文彩云 FZYaoTi 方正姚体简体 FZShuTi 方正舒体简体 NSimSun 新宋体 LiSu 隶书
其次要注意文件编码问题:将svg文件保存的时候要选择utf-8编码或者unicode编码,当然svg文件的encoding属性也应该是\"utf-8\" 3.判断鼠标事件来源
在SVG中会经常遇到判断鼠标事件来源的问题,比如:鼠标单击或者双击、滚轮事件等等。这里做一个简单的介绍。
判断鼠标是左键还是右键?
在onclick事件中,if(evt.button==0)则为左击,否则为右击 无论单击还是双击evt.detail==1 判断鼠标是单击还是双击?
在onclick事件中,if(evt.detail==2)则为双击,否则为单击 判断鼠标的滚轮事件?
function mousewheel() {
origscale=root.currentScale;
origscale +=event.wheelDelta / 1200; if (origscale > 0) {
root.currentScale=origscale;
root.currentTranslate.x=midx*root.currentScale+event.offsetX*(1-root.currentScale/midscale);
root.currentTranslate.y=midy*root.currentScale+event.offsetY*(1-
root.currentScale/midscale);
midscale=root.currentScale;
midx=root.currentTranslate.x/root.currentScale; midy=root.currentTranslate.y/root.currentScale; } }
4. SVG自适应高度和宽度
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务