gpt4 book ai didi

jquery CSS 行为

转载 作者:太空宇宙 更新时间:2023-11-03 20:02:27 26 4
gpt4 key购买 nike

下面的代码有点麻烦。本质上我有一个高度为:40px 的 div 容器,当我点击它时,它平滑地增长到 320px - 这很好用,但是当 div 增长到全高时,我希望溢出属性从它的静态状态改变从隐藏到可见。

$(document).ready(function() {
$('#join').click(function() {
$('#join').animate({ height: "320px" }, 500);
$('#join').css('overflow', 'visible');
})
});​

它确实会显示几秒钟然后消失,我也希望它在 div 增长到全高后发生。

最佳答案

animate 回调函数中应用样式。见下文,

$(this).animate({height:"320px"}, 500, function () { //this <- #join
$(this).css('overflow', 'visible');
});

完整代码:

$(document).ready(function() {
$('#join').click(function() {
$(this).animate({height:"320px"}, 500, function () {
$(this).css('overflow', 'visible');
});
});
});

关于jquery CSS 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10726299/

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