zoukankan      html  css  js  c++  java
  • jquery 打印宽高

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>获取各类宽高</title>
        <script src='../jquery-3.1.1.min.js'></script>
        <script>
            $(function(){
               //浏览器当前窗口可视区域高度
                console.log($(window).height());
                console.log($(window).width());
                //浏览器当前窗口文档的高度
                console.log($(document.body).height());
                console.log($(document.body).width());
                //浏览器的总高度包括padding border
                 console.log($(document.body).outerHeight(true));
                 console.log($(document.body).outerWidth(true));
                
            });
        </script>
    </head>
    <body>
        
    </body>
    </html>

     1、获取实际内容区域的宽和高:width()和height();
    2、获取实际内容区域+padding的宽和高:innerWidth()和innerHeight();
    3、获取实际内容区域+padding+border的宽和高:outerWidth()和outerHeight();
    4、获取实际内容区域+padding+border+margin的宽和高:outerWidth(true)和outerHeight(true)

  • 相关阅读:
    代理模式
    适配器模式
    原型模式
    创建者模式
    装饰模式
    web总结
    4.14
    4.14
    POJ2385
    POJ2229
  • 原文地址:https://www.cnblogs.com/hack-ing/p/6138968.html
Copyright © 2011-2022 走看看