JQuery实现DIV展开折叠类似Outlook效果

64 篇文章 0 订阅
34 篇文章 0 订阅
<!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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值