- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试了以下方法:
<!DOCTYPE html>
<html>
<head>
<title>#002</title>
<meta charset="UTF-8">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="../../resurces/js/remove_element.js"></script>
<script>
$("document").ready(function(){
document.getElementById("other").addEventListener("click",function(){
console.log("fired");
var animation = document.createElementNS("http://www.w3.org/2000/svg", "animation");
animation.setAttribute("id","anim_1");
animation.setAttribute("attributeName","height");
animation.setAttribute("attributeType","XML");
animation.setAttribute("dur","3.75s");
animation.setAttribute("fill","freeze");
animation.setAttribute("from","0");
animation.setAttribute("to","100");
animation.setAttribute("begin","indefinite");
animation.setAttribute("end","indefinite");
document.getElementById("RectElement").appendChild(animation);
console.log(animation);
animation.beginElement(); //ref. http://www.w3.org/TR/SVG/animate.html#__smil__ElementTimeControl__beginElement
setTimeout(function(){
animation.remove();
console.log("cleared_animation");
},2500);
});
});
</script>
</head>
<body>
<svg width="20cm" height="20cm" viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect id="other" x="0.5" y="0.5" width="98" height="98"
fill="none" stroke="blue" stroke-width="1" />
<rect id="RectElement" x="45" y="100" width="10" height="0"
fill="rgb(255,255,0)" transform="rotate(180, 50, 100)">
</rect>
</svg>
</body>
</html>
但是 Firefox 一直告诉我“animation.beginElement 不是一个函数”我使用了 this answer 中的示例, this one和 the last one 。我还在 w3 documentation 上查过。 .
有人可以告诉我我的错误在哪里吗?
最佳答案
不存在动画元素这样的东西。然而有一个animate大概就是您正在考虑的元素。
关于javascript - Animation.beginElement 不是一个函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30003378/
我正在使用 beginElement()在我的 Web 应用程序中启动 SVG 动画: document.getElementById("item").beginElement(); 但这会导致 IE
已关闭。这个问题是 not reproducible or was caused by typos 。目前不接受答案。 这个问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-top
本文整理了Java中cdc.util.xml.XmlWriter.beginElement()方法的一些代码示例,展示了XmlWriter.beginElement()的具体用法。这些代码示例主要来源
beginElement() 在 IE 中有效吗? 我在 Windows 7 上使用 Internet Explorer 11。这是 fiddle 。检查控制台,您会看到错误。它适用于 Chrome。
最终这是针对将在 Firefox 中运行的 Kiosk 风格应用程序(使用 jQuery 1.6.4),因此答案可以是特定于 Firefox 的。 我正在尝试制作动画 SVG,但我正在尝试通过动态插入
SVG 有一个 beginElement() method .但我似乎无法在 lib.d.ts 中找到它。目前,我必须将变量转换为“any”才能从 TypeScript 调用它而不会出现任何错误。 谁
我是一名优秀的程序员,十分优秀!