zoukankan      html  css  js  c++  java
  • 判断是否是pc,获取屏幕宽度

    $(function(){
    var w=document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;//先获取窗口宽度
        if(w>=768){
            var J_loginHeight=$(document).height()-$('.J_partfw').outerHeight();
            $('.J_login').css('min-height',J_loginHeight);
        }
    
        if (isPC()) {
            var contentHeight = document.body.scrollHeight;
    
            var winHeight;
            if (window.innerHeight != undefined) {
                winHeight = window.innerHeight;
            } else if (document.documentElement.clientHeight != 0) {
                //IE 8
                winHeight = document.documentElement.clientHeight;
            } else {
                //IE6,7
                winHeight = document.body.clientHeight;
            }
            /*if (!(contentHeight > winHeight)) {
                $(".J_partfw").addClass("fixed");
            } else {
                $(".J_partfw").removeClass("fixed");
            }*/
        }
    
    })
    
    function isPC() {
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                flag = false;
                break;
            }
        }
        return flag;
    }
  • 相关阅读:
    C#中的委托和事件(续)【来自张子扬】
    C# 中的委托和事件[转自张子扬]
    .NET多线程编程入门
    python——configparser模块
    logger模块
    python——time模块
    os模块
    python——re模块
    selenium环境搭建
    iOS中的三大定时器
  • 原文地址:https://www.cnblogs.com/romanticcrystal/p/11075748.html
Copyright © 2011-2022 走看看