F1V3.0-图形-svg渲染效果在chrome下失效解决方法
来源:互联网 发布:python xpath解析html 编辑:程序博客网 时间:2024/06/06 20:05
解决方法
方法 一
将静态化脚本中的一行脚本注释掉,如下:
document.writeln("<base href='"+getRootPath()+"'/>");
即<script type="text/javascript"> function getRootPath() { var pathName = window.location.pathname.substring(1); var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/')); //return window.location.protocol + '//' + window.location.host + '/'+ webName + '/'; return window.location.protocol + '//' + window.location.host + '/'+ webName+'/'; } // 注释掉,影响svg动画效果 //document.writeln("<base href='"+getRootPath()+"'/>");</script>
方法 二
修改动画的xlink:href属性:location.href+”#”+引用元素id
<svg width="500" height="350" viewBox="0 0 550 350"> <path id="motionPath-2" fill="none" stroke="#000000" stroke-miterlimit="10" d="M91.4,104.2c3.2-3.4,18.4-0.6,23.4-0.6c5.7,0.1,10.8,0.9,16.3,2.3 c13.5,3.5,26.1,9.6,38.5,16.2c12.3,6.5,21.3,16.8,31.9,25.4c10.8,8.7,21,18.3,31.7,26.9c9.3,7.4,20.9,11.5,31.4,16.7 c13.7,6.8,26.8,9.7,41.8,9c21.4-1,40.8-3.7,61.3-10.4c10.9-3.5,18.9-11.3,28.5-17.8c5.4-3.7,10.4-6.7,14.8-11.5 c1.9-2.1,3.7-5.5,6.5-6.5"/> <circle id="circle-2" r="20" cx="100" cy="100" fill="tomato" /> <animateMotion xlink:href="#circle-2" dur="1s" begin="click" fill="freeze"> <mpath xlink:href="http://192.168.1.28:8082/f1/demo.html#motionPath-2" /> </animateMotion></svg>
显示正常
## 二 原因在做静态化处理时会加入如下脚本:document.writeln("<base href='"+getRootPath()+"'/>");
<base> 标签为页面上的所有链接规定默认地址或默认目标。通常情况下,浏览器会从当前文档的 URL 中提取相应的元素来填写相对 URL 中的空白。使用 <base> 标签可以改变这一点。浏览器随后将不再使用当前文档的 URL,而使用指定的基本 URL 来解析所有的相对 URL。这其中包括 <a>、<img>、<link>、<form> 标签中的 URL。
svg里面的元素如果有用url的滤镜、模糊、动画等效果,受<base>影响,svg元素标签中的url将会改变,导致各种效果失效。
阅读全文
1 0
- F1V3.0-图形-svg渲染效果在chrome下失效解决方法
- F1V3.0-图形-GIS基础知识
- F1V3.0-图形-OpenLayers2体系分析
- F1V3.0-图形-绘图快捷操作帮助
- F1V3.0-图形-绘图框架主要功能简介
- F1V3.0-图形-前端绘图库简介
- XP系统下在FireFox3.6中使用Adobe svg viewer3显示SVG图形
- javascript:window.close()在chrome,Firefox下失效问题解决方法
- jQuery ajax方法在Chrome浏览器下失效问题
- javascript:window.close()在chrome,Firefox下失效问题解决方法
- F1V3.0-图形-地图模块主要对象说明
- F1V3.0-图形-自动成图-系统图算法介绍
- F1V3.0-图形-微服务模块打包部署
- F1V3.0-图形-自动成图-站内图成图过程
- F1V3.0-图形-拓扑连通性分析算法介绍
- 在UpdatePanel内jqueryeasyui效果失效的解决方法
- svg图形拖动的例子/解决方法
- 个人笔记:table中加align="center"居中在chrome和火狐失效解决方法
- 通过javax.validation.constraints下的注解实现字段验证
- 一个程序员的修炼之路
- locate: 无法执行 stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录
- 关于静态资源访问的路径问题
- python __call__
- F1V3.0-图形-svg渲染效果在chrome下失效解决方法
- iOS AVPlayer播放器 简介
- Centos 7.3 + PHP7.1.7 + Mariadb
- javadoc注释规范
- 代理设计模式
- 链表翻转
- 多路复用之epoll服务器应用
- 公证问答百科
- 【模拟】【贪心】POJ1877Flooded!