我一直在试图制作一个Dashboard Widget的div失踪动画,但它只是残酷地变成“噗”(如在,只是瞬间消失,如预期的那样)。动画div失踪,如何平滑?
function removeElement(elementId)
{
duration = 9000; // The length of the animation
interval = 13; // How often the animation should change
start = 1.0; // The starting value
finish = 0.0; // The finishing value
handler = function(animation, current, start, finish) {
// Called every interval; provides a current value between start and finish
document.getElementById(elementId).style.opacity = current;
};
new AppleAnimator(duration, interval, start, finish, handler).start();
interval = 1;
start= "visible";
finish = "hidden";
duration = 9001;
handler = function(animation, current, start, finish) {
document.getElementById(elementId).style.visibility="hidden";
};
new AppleAnimator(duration, interval, start, finish, handler).start();
}
我预计其不透明度达到零后“消失”在div毫秒,但对于一个不那么明显的原因(我),它只是立即消失。如果我注释掉第二个动画代码,div淡出(但它仍然是活动的,我不想要)。
我还没见过的所有解决方案都依赖于使用JQuery并在动画结束后等待事件,除了JQuery之外,还有其他方法可以实现吗?
好的,好的,它有帮助。 – frenchie 2012-03-01 18:01:22