JQuery实现DIV展开折叠类似Outlook效果
2014-07-01 18:20
666 查看
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#container{
width:100%;
background-color:#999;
}
#navigate{
width:25%;
float:left;
background-color:#999;
}
/*
左侧导航 顶部按钮
*/
#navTop {
background-color: grey;
height: 22px;
width: 100%;
}
#navTopRight {
background: url(Images/indicate.gif) no-repeat 50% 50%;
float: right;
width: 20px;
height: 100%;
margin-right: 5px;
}
#outercontent{
width:75%;
float:right;
background-color:#CCC;
z-index:10;
position:relative;
}
#content{
width:99%;
float:right;
background-color:#666;
z-index:11;
}
#ce{
position:absolute;
width:30px;
height:100px;
vertical-align:middle;
}
#seperator{
background-color:#900;
width:10px;
height:30px;
position:absolute;
top:50%;
border:solid 0px orange;
}
#seperatorHidden{
background-color: #e9edf1;
width:1%;
height:220px;
position:absolute;
border:solid 0px orange;
z-index:11;
}
.mini-tools {
width: 100%;
height: 20px;
background: url(Images/expand.gif) no-repeat 50% 50%;
}
#seperator:hover{
border:solid 1px orange;
}
.mini-layout-proxy {
background: #e9edf1;
border: solid 1px #A8A8A8;
cursor: default;
overflow: hidden;
height: 22px;
padding-left: 6px;
position: absolute;
z-index: 100;
left: -500px;
top: -500px;
}
</style>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function () {
//隐藏 展开DIV
$("#seperatorHidden").hide();
///为折叠按钮添加点击事件
$("#navTopRight").live("click", function () {
$("#navigate").animate({ width: "1%" }, 100);
$("#outercontent").animate({ width: "99%" }, 100);
$("#navigate").empty();
$("#navigate").html('<div id="seperatorHidden"><div class="mini-tools"></div></div>');
});
///为展开按钮添加点击事件
$(".mini-tools").live("click", function () {
$("#navigate").animate({ width: "25%" }, 100);
$("#outercontent").animate({ width: "75%" }, 100);
$("#navigate").empty();
$("#navigate").html('<div id="navTop"> <div id="navTopRight"></div></div>');
});
$("#seperator").toggle(function (event) {
$("#navigate").animate({ width: "1%" }, 100);
$("#outercontent").animate({ width: "99%" }, 100);
$("#seperatorHidden").show();
},
function (event) {
$("#navigate").animate({ width: "25%" }, 100);
$("#outercontent").animate({ width: "75%" }, 100);
});//toggle
});
function expend() {
alert("expand");
}
</script>
</head>
<body>
<div id="container">
<div id="navigate">
<div id="navTop">
<div id="navTopRight"></div>
<p><a href="http://www.baidu.com" target="test">百度</a></p>
<p><a href="http://www.sina.com" target="test">新浪</a></p>
<p><a href="http://www.sohu.com" target="test">搜狐</a></p>
</div>
</div>
<div id="outercontent">
<div id="seperator"></div>
<div id="content" >
<iframe width="500" height="300" name="test" ></iframe>
</div>
</div>
<br style="clear:both;" />
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#container{
width:100%;
background-color:#999;
}
#navigate{
width:25%;
float:left;
background-color:#999;
}
/*
左侧导航 顶部按钮
*/
#navTop {
background-color: grey;
height: 22px;
width: 100%;
}
#navTopRight {
background: url(Images/indicate.gif) no-repeat 50% 50%;
float: right;
width: 20px;
height: 100%;
margin-right: 5px;
}
#outercontent{
width:75%;
float:right;
background-color:#CCC;
z-index:10;
position:relative;
}
#content{
width:99%;
float:right;
background-color:#666;
z-index:11;
}
#ce{
position:absolute;
width:30px;
height:100px;
vertical-align:middle;
}
#seperator{
background-color:#900;
width:10px;
height:30px;
position:absolute;
top:50%;
border:solid 0px orange;
}
#seperatorHidden{
background-color: #e9edf1;
width:1%;
height:220px;
position:absolute;
border:solid 0px orange;
z-index:11;
}
.mini-tools {
width: 100%;
height: 20px;
background: url(Images/expand.gif) no-repeat 50% 50%;
}
#seperator:hover{
border:solid 1px orange;
}
.mini-layout-proxy {
background: #e9edf1;
border: solid 1px #A8A8A8;
cursor: default;
overflow: hidden;
height: 22px;
padding-left: 6px;
position: absolute;
z-index: 100;
left: -500px;
top: -500px;
}
</style>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function () {
//隐藏 展开DIV
$("#seperatorHidden").hide();
///为折叠按钮添加点击事件
$("#navTopRight").live("click", function () {
$("#navigate").animate({ width: "1%" }, 100);
$("#outercontent").animate({ width: "99%" }, 100);
$("#navigate").empty();
$("#navigate").html('<div id="seperatorHidden"><div class="mini-tools"></div></div>');
});
///为展开按钮添加点击事件
$(".mini-tools").live("click", function () {
$("#navigate").animate({ width: "25%" }, 100);
$("#outercontent").animate({ width: "75%" }, 100);
$("#navigate").empty();
$("#navigate").html('<div id="navTop"> <div id="navTopRight"></div></div>');
});
$("#seperator").toggle(function (event) {
$("#navigate").animate({ width: "1%" }, 100);
$("#outercontent").animate({ width: "99%" }, 100);
$("#seperatorHidden").show();
},
function (event) {
$("#navigate").animate({ width: "25%" }, 100);
$("#outercontent").animate({ width: "75%" }, 100);
});//toggle
});
function expend() {
alert("expand");
}
</script>
</head>
<body>
<div id="container">
<div id="navigate">
<div id="navTop">
<div id="navTopRight"></div>
<p><a href="http://www.baidu.com" target="test">百度</a></p>
<p><a href="http://www.sina.com" target="test">新浪</a></p>
<p><a href="http://www.sohu.com" target="test">搜狐</a></p>
</div>
</div>
<div id="outercontent">
<div id="seperator"></div>
<div id="content" >
<iframe width="500" height="300" name="test" ></iframe>
</div>
</div>
<br style="clear:both;" />
</div>
</body>
</html>
相关文章推荐
- Jquery实现的一个DIV层面板的折叠/展开效果
- jQuery实现DIV层的收缩展开效果
- jQuery实现DIV响应鼠标滑过由下向上展开效果示例【测试可用】
- jquery实现多个gridview折叠展开效果
- jQuery实现折叠、展开的菜单组效果代码
- jQuery实现折叠、展开的菜单组效果代码
- jquery实现点击查看更多内容控制段落文字展开折叠效果
- jquery 在指定位置弹出div框并实现从下向上展开效果
- jQuery实现可展开折叠的导航效果示例
- jquery 在指定位置弹出div框并实现DIV由下向上展开的效果
- jquery实现点击查看更多内容控制段落文字展开折叠效果
- Jquery实现如何实现DIV由下向上展开的效果,鼠标浮动时div由下向上缓慢展开。
- [给力原创]使用jQuery-ajax仿新浪微博通知折叠/显示效果,实现数据加载
- css实现类似相框的阴影div的shadow效果
- 原生Js与jquery的多组处理, 仅展开一个区块的折叠效果
- DIV+JS实现可展开、折叠的菜单代码
- Javascript实现的类似Google的Div拖动效果代码
- 用js实现类似jquery里的animate动画效果
- jquery实现"跳到底部","回到顶部"效果(类似锚)
- 【jquery】结合class选择器、next、prev方法实现相邻的节点展开隐藏效果