gpt4 book ai didi

jquery - 在 css 文件中为 jquery .animate() 声明 css 属性

转载 作者:行者123 更新时间:2023-12-01 02:48:25 24 4
gpt4 key购买 nike

在实现 jquery .animate() 时,我必须这样写

$('#clickme').click(function() {
$('#book').animate({
width: '200px',
height: '500px'
})
})

是否有某种方法可以将 css 属性写入 css 文件中,然后通过包含 css 属性来执行“动画”?

类似于

.move{
width: '200px',
height: '500px'
}

然后

$('#book').animate({
// include the .move css class somehow
})

我尝试使用 $( "#effect").addClass( "newClass", 1000 ); 但没有动画,属性似乎只是在声明的持续时间之后分配!!

最佳答案

jQuery UI 项目扩展了 addClass 方法,以准确满足您的需求。

jQuery UI - addClass .

关于jquery - 在 css 文件中为 jquery .animate() 声明 css 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6217320/

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