Window Position
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的更多相关文章
- LeetCode题解-----Sliding Window Maximum
题目描述: Given an array nums, there is a sliding window of size k which is moving from the very left of ...
- [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 ...
- 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 ...
- javascript position兼容性随笔
一.Javascript源码 if (!window.jasen.core.Position) { window.jasen.core.Position = {}; } function Size(w ...
- POJ 2823 Sliding Window + 单调队列
一.概念介绍 1. 双端队列 双端队列是一种线性表,是一种特殊的队列,遵守先进先出的原则.双端队列支持以下4种操作: (1) 从队首删除 (2) 从队尾删除 (3) 从队尾插入 (4) ...
- POJ 2823 Sliding Window 题解
POJ 2823 Sliding Window 题解 Description An array of size n ≤ 106 is given to you. There is a sliding ...
- POJ 2823 Sliding Window
Sliding Window Time Limit: 12000MSMemory Limit: 65536K Case Time Limit: 5000MS Description An array ...
- POJ2823 Sliding Window
Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 53086 Accepted: 15227 Case Time Limi ...
- POJ2823Sliding Window
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 49919 Accepted: 14391 ...
随机推荐
- 配置LANMP环境(7)-- 配置nginx反向代理,与配置apache虚拟主机
一.配置nginx反向代理 1.修改配置文件 vim /etc/nginx/nginx.conf 在35行http下添加一下内容: include /data/nginx/vhosts/*.conf; ...
- mysqldump 使用--tab=path参数时提示mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
报错: [root@zedu test]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab ...
- vue的store状态管理模式
var store = { debug: true, state: { message: 'Hello!' }, setMessageAction (newValue) { //所有 store 中 ...
- Spark配置详解
Spark提供三个位置用来配置系统: Spark属性:控制大部分的应用程序参数,可以用SparkConf对象或者Java系统属性设置 环境变量:可以通过每个节点的 conf/spark-env.sh脚 ...
- 进击JavaScript核心 --- (3)面向对象
JS中的对象定义为:无序属性的结合,其属性可以包含基本值.对象或者函数 1.定义对象的方式 (1).Object构造函数 var student = new Object(); student ...
- No server 没有服务器
先本地下载tomcat 参考 https://www.cnblogs.com/limn/p/9358657.html 下载后参考 https://jingyan.baidu.com/article/3 ...
- cogs服务点设置(不凶,超乖) x
cogs3. 服务点设置 ★ 输入文件:djsa.in 输出文件:djsa.out 简单对比时间限制:1 s 内存限制:128 MB 问题描述为了进一步普及九年义务教育,政府要在某乡镇 ...
- 灰度图像--图像分割 Scharr算子
学习DIP第46天 转载请标明本文出处:http://blog.csdn.net/tonyshengtan ,出于尊重文章作者的劳动,转载请标明出处!文章代码已托管,欢迎共同开发: https://g ...
- Android_(控件)使用ListView显示Android系统SD卡的文件列表_02
使用ListView显示Android SD卡中的文件列表 父类布局activity_main.xml,子类布局item_filelayout(一个文件的单独存放) 运行截图: 程序结构 <?x ...
- excel中如何设置只打印第一页
在打印表格时,怎样设置只打印第一页呢,操作很简单,下面,小编说下操作方法. 方法/步骤 打开要打印的工作表, 再点击“文件” 弹出的页面中,在左侧这里,点击“打印” 在右边弹出与打 ...