在我正在处理的页面中,当用户单击一个对象时,一个 SVG 组会旋转,而另一个 SVG 组会旋转。
代码在 WebKit 中运行良好,但在 Gecko 中根本无法运行。以下是 Gecko 未执行的代码块:
var totStep = dur*2/msrate, step=0;
window.timer = window.setInterval(function(){
if(step<totStep/2){
var inangle = -50*easeIn(step,totStep/2);
iris.setAttribute("transform","rotate("+inangle+" 23 -82)");}else{
var prog = easeOut2((step-(totStep/2)),totStep/2);
var outangle = 50*prog;
var down = 400*prog;
vinyl.setAttribute("transform","rotate("+(-50+outangle)+" 986 882)");
needle1.setAttribute("transform","translate(0 "+(-400+down)+")");
buttons.setAttribute("transform","translate(0 "+(-400+down)+")");}
step++;
if (step > totStep) {window.clearInterval(window.timer); return}
});
大部分代码改编自一个在页面加载时打开眼睛的函数,并且该函数在 Gecko 中运行良好,这就是为什么这对我来说很神秘。
您可以在此页面上查看该页面及其所有源代码。有问题的函数写在链接的eye.js中。当用户单击菜单的“音乐”部分下的“DJ Docroot”时会出现问题,该菜单可通过单击任意位置访问。