gpt4 book ai didi

Jquery 动画() : storing css key/value pairs

转载 作者:行者123 更新时间:2023-12-01 03:40:37 25 4
gpt4 key购买 nike

如果我有类似的东西

$('#element').animate({'top':'-140px'},2000);

是否可以以某种方式预先定义一堆键/值对,这样我就可以使用

 $('#element').animate(firstPos,2000).animate(secondPos,2000);

提前致谢。

最佳答案

请参阅此示例:

http://jsfiddle.net/3Fyb8/

var firstPos= {'top':'40px'};
var secondPos= {'top':'80px'};
$('#element').animate(firstPos,2000).animate(secondPos,2000);

关于Jquery 动画() : storing css key/value pairs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21414205/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com