如何最大化和最小化一个div [英] How to maximize and minimize a div
本文介绍了如何最大化和最小化一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何最大化和最小化div。我可以根据需要调整div的大小。
解决方案
我想你需要这样的东西
http://jsfiddle.net/miqdad/Qy6Sj/1/
您可以在jsfiddle中查看代码,这里是我所做的代码,创建了一个div,里面有另一个div,作为标题栏和内容框
< div id =widnow>
< div id =title_bar>
< div id =button> - < / div>
< / div>
< div id =box>
< / div>
< / div>
css
#widnow {
width:400px;
border:solid 1px;
}
#title_bar {
background:#FEFEFE;
height:25px;
宽度:100%;
}
#button {
border:solid 1px;
width:25px;
height:23px;
float:right;
光标:指针;
}
#box {
height:250px;
背景:#DFDFDF;
}
jquery $ b
$(#button)。click(function(){
if($(this).html()== - ) {
$(this).html(+);
}
else {
$(this).html( - );
}
$(#box)。slideToggle();
});
How to maximize and minimize a div. Can I resize div according to as need.
解决方案
I think you need something like this
http://jsfiddle.net/miqdad/Qy6Sj/1/
You can view the code in jsfiddle here is the code what I have done created a div with another div inside as title bar and content box
html
<div id="widnow">
<div id="title_bar">
<div id="button">-</div>
</div>
<div id="box">
</div>
</div>
css
#widnow{
width:400px;
border:solid 1px;
}
#title_bar{
background: #FEFEFE;
height: 25px;
width: 100%;
}
#button{
border:solid 1px;
width: 25px;
height: 23px;
float:right;
cursor:pointer;
}
#box{
height: 250px;
background: #DFDFDF;
}
jquery
$("#button").click(function(){
if($(this).html() == "-"){
$(this).html("+");
}
else{
$(this).html("-");
}
$("#box").slideToggle();
});
这篇关于如何最大化和最小化一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文