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 ...
随机推荐
- BZOJ 1002 生成树计数&高精度
给你定义一种特殊的图 这种图总共有n个节点 假设编号为0~n-1 首先1~n-1排成环形 每个点与相邻的两个点有边 其次这n-1个节点每个和0节点有一条边 每次询问你一个n 要回到当前n节点的特殊图有 ...
- Web Api(4)
参考原文链接https://www.cnblogs.com/JamelAr/,本文大部分内容是根据这位博主进行实验测试的,非常感谢分享,另外也参考了https://www.cnblogs.com/vi ...
- 【ORACLE语句备份】数据库表同步 ——定时任务管理器(EXPDP导出,IMPDP导入)
1.C:\Users\Administrator>sqlplus sys/xxx@xxx as sysdba; 2.SQL> create directory dbbak4 as 'e:\ ...
- 题解 【POJ1722】 SUBTRACT
先讲下题目意思 给定一个长度为\(n\)的序列\((1 \leq n \leq 100)\), 每次合并两个元素\(i,i+1\),即将\(i,i+1\)变为一个新的元素,权值为\(a[i]-a[i+ ...
- yii框架学习(安装)
安装yii: 在本地安装前, 要确保PHP配置了环境变量, 通过cmd输入PHP -v 即可检测. 能看到PHP版本号, 则OK. PHP不是内部命令,则需要添加PHP环境变量. 使用compos ...
- perl 纯变量(Scalar) 转载
转载http://blog.chinaunix.net/uid-20639775-id-154591.html Perl有三种变量: 纯变量(Scalar Varible) 数组(Array) 关联数 ...
- 牛客训练41D最小相似度bfs
最小相似度 题目大意:对于位数相同的两个二进制串,SIM(A,B)为它们的相似度,也就是A^B中0的个数.现在给定一堆串,找出一个T使得max{SIM(S1,T),SIM(S2,T),......,S ...
- OpenCV使用Cmake来管理工程
写篇入门级别的文章,对于配置OpenCV很多人不知道有这种方法,其实这种方法在OpenCV编译过程中已经使用到的了,如果有手动编译OpenCV经验的同学可以很快的学会这种工程管理方法 方法优点,只要有 ...
- 关于brew没有搜索到php的解决方案
在终端添加php的资源包 brew tap homebrew/homebrew-php 链接 https://github.com/Homebrew/homebrew-php
- DelayQueue实现延迟队列
public class Q { public static void main(String[] args) throws Exception { DelayQueue<Order> o ...