gpt4 book ai didi

javascript - 垂直可折叠面板 - 在加载时显示为折叠

转载 作者:行者123 更新时间:2023-11-30 08:46:22 25 4
gpt4 key购买 nike

我怎样才能拥有 <div>页面加载时已经折叠?

我有一个 JS Fidle到目前为止我所拥有的。


HTML

<button id="aa">Toggle it up</button>

<div id="test">TEST</div>

CSS

div { 
background:#0F0;
margin:3px;
width:600px;
height:600px;
float:right;
}
div.test {
background:#345;
width:5px;
}
#aa {width: 100px;
height: 600px;
position: absolute;
top: 3px;
right: 0px;
z-index: 10
float: right;
}

JavaScript

$("#aa").click(function () {
$("div").animate({width: 'toggle'});;
});

最佳答案

CSS

使用css隐藏div

#test{
display:none;
}

Fiddle Demo


jQuery

$('#test').hide();

JavaScript

document.getElementById('test').style.display = 'none';

关于javascript - 垂直可折叠面板 - 在加载时显示为折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21702371/

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