zoukankan      html  css  js  c++  java
  • 窗口模块自适应高度

    JQuery:

    $(document).ready(function(){
    alert($(window).height()); //浏览器当前窗口可视区域高度
    alert($(document).height()); //浏览器当前窗口文档的高度
    alert($(document.body).height());//浏览器当前窗口文档body的高度
    alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin

    alert($(window).width()); //浏览器当前窗口可视区域宽度
    alert($(document).width());//浏览器当前窗口文档对象宽度
    alert($(document.body).width());//浏览器当前窗口文档body的宽度
    alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin

    })

    <!DOCTYPE html>
    <html>
    <head>
        <script src="js/jquery-1.11.3.min.js"></script>
        <style>
            * {
                margin:0;
                padding:0;
            }
            body{
                margin:0 auto;
                
            }
            #header{
                height:100px;
                background:#444;
            }
            
            #footer{
                background:#0094ff;
                height:100px;
            }
            #container{
                background:url(body_bg.gif);
                min-height:400px;
                max-height:600px;
            }
        </style>
        <script>
            $(function () {
                $("#container").height($(window).height() - 200);
                $(window).resize(function(){
                      $("#container").height($(window).height() - 200);
            });
            });
        </script>
    </head>
    <body>
    
     <div id="header">我是头部</div>
        <div id="container">
    
    
    
        </div>
        <div id="footer">
            <p>
                版本信息:::::
            </p>
        </div>
    </body>
    </html>
  • 相关阅读:
    MVC 小demo
    单例模式
    简单工厂模式
    有关ajax中的URL问题
    SqlHelper++
    C# 操作XML
    C# 注册DLL(使用cmd)
    图片延迟加载库Layzr
    解决Ajax跨域问题:Origin xx is not allowed by Access-Control-Allow-Origin.
    HTML5 + SOCKET视频传输
  • 原文地址:https://www.cnblogs.com/lunawzh/p/4863538.html
Copyright © 2011-2022 走看看