[英]SVG Rect Height Setting Not Working on FireFox & Ms Edge
Can you please take look at this demo and let me know why the height
animation not working on Firefox and MS Edge? 您能否看一下这个演示 ,让我知道为什么
height
动画不能在Firefox和MS Edge上运行?
It is Working fine on Chrome 在Chrome上运行正常
$("#app").hover(function(){ $('#fillup').animate({height: "320"},3000); console.log("In"); }, function(){ $('#fillup').animate({height: "0"},3000); console.log("Out"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <svg width="320" height="320" viewBox="0 0 320 320" id="app"> <rect x="0" y="0" width="320" height="0" fill="#47f" id="fillup" /> </svg>
In Edge and Firefox you must treat height as an attribute, as SVG 1.1 does rather than a style as SVG 2 proposes. 在Edge和Firefox中,必须像SVG 1.1一样将高度视为属性,而不是SVG 2所建议的样式。
$("#app").hover(function(){ $('#fillup').animate( { height: 320 }, { duration: 3000, step: function(now) { $(this).attr("height", now); } }); console.log("In"); }, function(){ $('#fillup').animate( { height: 0 }, { duration: 3000, step: function(now) { $(this).attr("height", now); } }); console.log("Out"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <svg width="320" height="320" viewBox="0 0 320 320" id="app"> <rect x="0" y="0" width="320" height="0" fill="#47f" id="fillup" /> </svg>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.