gpt4 book ai didi

jQuery 切换动画

转载 作者:行者123 更新时间:2023-12-03 21:35:55 25 4
gpt4 key购买 nike

我有这个 jQuery:

$(document).ready(function()
{
$("#panel").hide();

$('.login').toggle(
function()
{
$('#panel').animate({
height: "150",
padding:"20px 0",
backgroundColor:'#000000',
opacity:.8
}, 500);
},
function()
{
$('#panel').animate({
height: "0",
padding:"0px 0",
opacity:.2
}, 500);
});
});

这工作正常,但我需要稍微扩展一下功能。我还想以类似的方式与 #panel div 同步操作另一个 div 的属性。我尝试添加两个与辅助 div 相关的函数,但我只得到了 4 相切换...哈哈!原谅我的无知!

谢谢大家!

最佳答案

$('.login').toggle(
function(){
$('#panel').animate({
height: "150",
padding:"20px 0",
backgroundColor:'#000000',
opacity:.8
}, 500);
$('#otherdiv').animate({
//otherdiv properties here
}, 500);
},
function(){
$('#panel').animate({
height: "0",
padding:"0px 0",
opacity:.2
}, 500);
$('#otherdiv').animate({
//otherdiv properties here
}, 500);
});

关于jQuery 切换动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/931113/

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