zoukankan      html  css  js  c++  java
  • js文档视口高度函数

    objwin=window;objBody=document.body;objDel=document.documentElement;   关于弹窗时候用到

    function getPageHeight() { //文档高度 scrollMaxY 火狐Mozilla
    var h = (objWin.innerHeight && objWin.scrollMaxY) ? (objWin.innerHeight + objWin.scrollMaxY) : (objBody.scrollHeight > objBody.offsetHeight ? objBody.scrollHeight : objBody.offsetHeight);
    return Math.max(h, objDel.scrollHeight)
    }

    function getPageWidth() {
    return (objWin.innerWidth && objWin.scrollMaxX) ? (objWin.innerWidth + objWin.scrollMaxX) : (Math.max(objBody.scrollWidth, objBody.offsetWidth))
    }

    function getWinHeight() { //可视化高度
    return (objWin.innerHeight) ? objWin.innerHeight : (objDel && objDel.clientHeight) ? objDel.clientHeight : objBody.clientHeight
    }

    function getWinWidth() {
    return (objWin.innerWidth) ? objWin.innerWidth : (objDel && objDel.clientWidth) ? objDel.clientWidth : objBody.clientWidth
    }

    function getMaxH() {
    var a = getPageHeight(),
    wh = getWinHeight();
    return Math.max(a, wh)
    }

    function getMaxW() {
    var a = getPageWidth(),
    ww = getWinWidth();
    return Math.max(a, ww)
    }

  • 相关阅读:
    熟悉常用的HBase操作,编写MapReduce作业
    爬虫大作业
    熟悉常用的HDFS操作
    数据结构化与保存
    获取全部校园新闻
    爬取校园新闻首页的新闻
    网络爬虫基础练习
    leetcode
    归并排序
    选择排序法
  • 原文地址:https://www.cnblogs.com/rainbow661314/p/3317119.html
Copyright © 2011-2022 走看看