jquery超级简单的后台系统自适应框架

系统后台自适应简单框架

<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>系统后台自适应简单框架</title>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<style type="text/css">
    html { *background-image:url(about:blank); *background-attachment:fixed;border: none; margin: 0px; padding: 0px;}
    body{ font-size: 12px; width: 100%;margin: 0px; padding: 0px;}
    /*清除浮动 S*/
    .clearfix { #zoom:1; }
    .clearfix:after { content:'.'; height:0; line-height:0; display:block; clear:both; visibility:hidden; }
    /*清除浮动 E*/
    #header{ width: 100%; min-height: 100px; background:  #ececec; background-color: #ececec;}
    #center{ width: 100%;min-height: 300px; position: relative; margin: 10px auto; }
    #center .leftCom{ width: 200px;  position: absolute; left: 0; border: 1px solid #ddd; border-left: 0 none; min-height: 300px; z-index: 1;}
    #center .leftColseOpen{ position: absolute;z-index: 2;cursor: pointer;}
    #center .rightCom{ width: 100%;position: absolute;border: 1px solid #f00;right: 10px; min-height: 300px; }
    #footer{ width: 100%;min-height: 50px;background-color: #f60; position: fixed; bottom: 0;}
</style>

</head>

<body>
<div id="header"></div>
<div id="center" class="clearfix">
    <div class="leftCom"></div>
    <div class="leftColseOpen">关闭</div>
    <div class="rightCom"></div>
</div>
<div id="footer"></div>

<script type="text/javascript">
    var main=(function(){
        function windFun(){
            var widH=$(window).height(),
            headH=$("#header").height(),
            footH=$("#footer").height(),
            mainH=widH-headH-footH-20,
            widW=$(window).width(),
            leftW=$(".leftCom").width(),
            mainW=widW-leftW-30;
            $(".leftCom,.rightCom").css("height",mainH);
            $(".rightCom").css({"width":mainW,"left":leftW+10});
            $(".leftColseOpen").css({"top":mainH/2,"left":leftW});
        }
        function colseOpenClick(){
            $(".leftColseOpen").toggle(function(){
                $(".leftCom").css({"display":"none","width":0});
                $(this).text("打开");
                windFun();
            },function(){
                $(".leftCom").css({"display":"block","width":200});
                $(this).text("关闭");
                windFun();
            })
        }
        return{
            windFunm:function(){windFun();},
            colseOpenClickn:function(){colseOpenClick();}
        }
    })();

    $(function(){
        main.windFunm();
        $(window).resize(function(){
            main.windFunm();
        })
        main.colseOpenClickn();
    })
</script>
</body>
</html>

 

posted @ 2014-11-12 10:49  落日知暮  阅读(728)  评论(0编辑  收藏  举报
作者:boyzi007 出处:http://www.cnblogs.com/boyzi/ QQ:470797533 QQ交流群:364307742 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。