zoukankan      html  css  js  c++  java
  • 在ASP.NET AJAX中如何判断浏览器及计算其宽高

    在ASP.NET AJAX中如何判断浏览器及计算其宽高
                function getClientBounds()
                
    {
                    
    var clientWidth;
                    
    var clientHeight;
                    
    switch(Sys.Browser.agent) {
                        
    case Sys.Browser.InternetExplorer:
                            clientWidth 
    = document.documentElement.clientWidth;
                            clientHeight 
    = document.documentElement.clientHeight;
                            
    break;
                        
    case Sys.Browser.Safari:
                            clientWidth 
    = window.innerWidth;
                            clientHeight 
    = window.innerHeight;
                            
    break;
                        
    case Sys.Browser.Opera:
                            clientWidth 
    = Math.min(window.innerWidth, document.body.clientWidth);
                            clientHeight 
    = Math.min(window.innerHeight, document.body.clientHeight);
                            
    break;
                        
    default:  // Sys.Browser.Firefox, etc.
                            clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
                            clientHeight 
    = Math.min(window.innerHeight, document.documentElement.clientHeight);
                            
    break;
                    }


                    
    return new Sys.UI.Bounds(00, clientWidth, clientHeight);
                }
  • 相关阅读:
    【C#】C#8.0常用新特性
    【Docker】Asp.net core在docker容器中的端口问题
    【gRPC】ProtoBuf 语言快速学习指南
    【日常排雷】 .Net core 生产环境appsetting读取失败
    【gRPC】 在.Net core中使用gRPC
    raspbian buster阿里镜像
    管道通信
    关于utf8mb4的使用
    ef core数据迁移的一点小感悟
    windows 端口转发
  • 原文地址:https://www.cnblogs.com/zwei1121/p/759308.html
Copyright © 2011-2022 走看看