IE, Safari, Opera, and Chrome all provide screenLeft and screenTop properties that indicate the window's location in relation to the left and top of the screen, respectively. Firefox provides this functionality through the screenX and screenY, which are also supported in Safari and Chrome. Opera supported screenX and screenY, but you should avoid using them in Opera, because they don't correspond to screenLeft and screenTop. The following code determines the left and top positions of the window across browsers:

 var leftPos = (typeof window.screenLeft == "number")? window.screenLeft : window.screenX;
var topPos = (typeof window.screenTop == "number")? window.screenTop : window.screenY;

  This example uses the ternary operator to determine if the screenLeft and screenTop properties exist. If they do(which is the case in IE, Safari, Opera, and Chrome), they are used. If they don't exist(as in Firefox), screenX and screenY are used.

  There are some quirks to using these values. In Internet Explorer, Opera, and Chrome, screenLeft and screenTop refer to the space from the left and top of the screen to the page view area represented by window. If the window object is the topmost object and the browser window is at the very top of the screen(with a y-coordinate of 0), the screenTop value will be the pixel height of the browser toolbars that appear above the page view area. Firefox and Safari treate these coordinates as being related to the entire browser window, so placing the window at y-coordiate 0 on the screen returns a top position of 0.

  

Window Position的更多相关文章

  1. LeetCode题解-----Sliding Window Maximum

    题目描述: Given an array nums, there is a sliding window of size k which is moving from the very left of ...

  2. [LeetCode] Sliding Window Maximum 滑动窗口最大值

    Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...

  3. 239. Sliding Window Maximum *HARD* -- 滑动窗口的最大值

    Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...

  4. javascript position兼容性随笔

    一.Javascript源码 if (!window.jasen.core.Position) { window.jasen.core.Position = {}; } function Size(w ...

  5. POJ 2823 Sliding Window + 单调队列

    一.概念介绍 1. 双端队列 双端队列是一种线性表,是一种特殊的队列,遵守先进先出的原则.双端队列支持以下4种操作: (1)   从队首删除 (2)   从队尾删除 (3)   从队尾插入 (4)   ...

  6. POJ 2823 Sliding Window 题解

    POJ 2823 Sliding  Window 题解 Description An array of size n ≤ 106 is given to you. There is a sliding ...

  7. POJ 2823 Sliding Window

    Sliding Window Time Limit: 12000MSMemory Limit: 65536K Case Time Limit: 5000MS Description An array ...

  8. POJ2823 Sliding Window

    Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 53086   Accepted: 15227 Case Time Limi ...

  9. POJ2823Sliding Window

    Sliding Window Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 49919   Accepted: 14391 ...

随机推荐

  1. context:component-scan 注解的扫描

    <context:component-scan base-package="com.matt.cloud"/> bean-context中 spring.handler ...

  2. 计划任务 at,cron

    示例:每3小时echo和wall命令

  3. 12-SSMS图形化工具中不允许保存修改的解决办法

    1.报出的警告 2.解决办法 工具-->选项-->设计器--->表设计和数据库设计器-->阻止保存要求重新创建表的更改  的勾去掉就OK 了

  4. 02-SQLServer数据库附加后处于只读模式

    一.总结 附加数据库后,遇到只读,并且取消只读的时候报错操作系统错误,一般都是附加的时候,使用的是SQLServer用户登录附加的,只要使用windows用户登录数据库重新附加一下就ok了. 二.处理 ...

  5. tcpip入门的网络教程汇总

    网络编程懒人入门(一):快速理解网络通信协议(上篇) http://www.52im.net/thread-1095-1-1.html TCP/IP详解学习笔记 https://www.cnblogs ...

  6. php类知识点滴---类的实例化,构造函数,继承初步

    实例化类----黑科技用法,通过字符串来实例化 class coach { public function __construct() { echo "欢迎光临北武堂"." ...

  7. PHP:函数和语言结构(转)

    转自:https://www.cnblogs.com/fanqiechaodan/articles/5222366.html 什么是语言结构呢?它和函数有什么不同吗? 1.  什么是语言结构和函数 语 ...

  8. jquery trigger() 方法 语法

    jquery trigger() 方法 语法 作用:trigger() 方法触发被选元素的指定事件类型.深圳大理石平台 触发事件:规定被选元素要触发的事件. 语法:$(selector).trigge ...

  9. idea 2017 破解方法

    一.先进入Intellij IDEA的官网:https://www.jetbrains.com,下载安装 二.破解. 网上的破解方法较多,总结下来大概有下面几种办法供大家作为参考 声明:破解用于学习和 ...

  10. flask框架(六): 实现支持正则的路由

    一:默认路由 @app.route('/user/<username>') @app.route('/post/<int:post_id>') @app.route('/pos ...