zoukankan      html  css  js  c++  java
  • js和jq获取宽度和高度

    Javascript:

    console.log(document.body.clientWidth); //网页可见区域宽(body)

    console.log(document.body.clientHeight); //网页可见区域高(body)

    console.log(document.body.offsetWidth); //网页可见区域宽(body),包括border、margin等

    console.log(document.body.offsetHeight); //网页可见区域宽(body),包括border、margin等

    console.log(document.body.scrollWidth); //网页正文全文宽,包括有滚动条时的未见区域

    console.log(document.body.scrollHeight); //网页正文全文高,包括有滚动条时的未见区域

    console.log(document.body.scrollTop); //网页被卷去的Top(滚动条)

    console.log(document.body.scrollLeft); //网页被卷去的Left(滚动条)

    console.log(window.screenTop); //浏览器距离Top

    console.log(window.screenLeft); //浏览器距离Left

    console.log(window.screen.height); //屏幕分辨率的高

    console.log(window.screen.width); //屏幕分辨率的宽

    console.log(window.screen.availHeight); //屏幕可用工作区的高

    console.log(window.screen.availWidth); //屏幕可用工作区的宽

    Jquery:

    console.log($(window).height()); //浏览器当前窗口可视区域高度

    console.log($(document).height()); //浏览器当前窗口文档的高度

    console.log($(document.body).height()); //浏览器当前窗口文档body的高度

    console.log($(document.body).outerHeight(true)); //浏览器当前窗口文档body的总高度 包括border padding margin

    console.log($(window).width()); //浏览器当前窗口可视区域宽度

    console.log($(document).width()); //浏览器当前窗口文档对象宽度

    console.log($(document.body).width()); //浏览器当前窗口文档body的宽度

    console.log($(document.body).outerWidth(true)); //浏览器当前窗口文档body的总宽度 包括border padding margin
  • 相关阅读:
    生产型企业原材料采购及入库的处理
    OpenERP财务管理若干概念讲解
    OE context 传参数
    Openerp 中打开 URL 的三种 方法
    view xml 中的 button 调用web客户端事件
    一招解决OpenERP8.0安装旧版模块报错
    ubuntu server激活即时通讯IM服务 Instant Messaging is not activated on this server
    error: command 'gcc' failed with exit status 1 while installing eventlet
    OpenERP函數字段的應用
    Doker容器之间连接
  • 原文地址:https://www.cnblogs.com/victory820/p/6673632.html
Copyright © 2011-2022 走看看