当前位置:网站首页>图解事件坐标screenX、clientX、pageX, offsetX的区别
图解事件坐标screenX、clientX、pageX, offsetX的区别
2022-07-01 06:29:00 【song854601134】
图解事件坐标screenX、clientX、pageX, offsetX的区别
一、图解

如图所示,假设页面中灰色圆点是鼠标点击处,黄色区域是鼠标触发事件对象
二、概念
1、screenX 和screenY
- 参照点:电脑屏幕左上角
- screenX:鼠标点击位置相对于电脑屏幕左上角的水平偏移量
- screenY:鼠标点击位置相对于电脑屏幕左上角的垂直偏移量
2、clientX和clientY
- 参照点:浏览器内容区域左上角
- clientX:鼠标点击位置相对于浏览器可视区域的水平偏移量(不会计算水平滚动的距离)
- clientY:鼠标点击位置相对于浏览器可视区域的垂直偏移量(不会计算垂直滚动条的距离)
3、pageX和pageY
- 参照点:网页的左上角
- pageX:鼠标点击位置相对于网页左上角的水平偏移量,也就是clientX加上水平滚动条的距离
- pageY:鼠标点击位置相对于网页左上角的垂直平偏移量,也就是clientY加上垂直滚动条的距离
4、offsetX和offsetY
- offsetX:鼠标点击位置相对于触发事件对象的水平距离
- offsetY:鼠标点击位置相对于触发事件对象的垂直距离
三、事件对象参数

边栏推荐
- [summary of problem thinking] Why is the register reset performed in user mode?
- Interview questions for HW (OD) post
- 产品学习(三)——需求列表
- Some pits designed by NOC
- 存储函数学习笔记
- 软件工程复习
- 解决The code generator has deoptimised the styling of xxxx.js as it exceeds the max of 500kb
- 给逆序对数求原数组
- @Transactional的传播属性REQUIRES_NEW深入理解
- 3. Disabling copy construction
猜你喜欢

idea 好用插件汇总!!!

Detailed steps for installing redis on Windows system

mysql学习

NOC 设计的一些坑

2022 Jiangsu Vocational College skills competition (secondary vocational school) network construction and application open competition volume
![[unity shader stroke effect _ case sharing first]](/img/bd/5cd1bef24e6b6378854114c2c05bd9.png)
[unity shader stroke effect _ case sharing first]

Mongodb: I. what is mongodb? Advantages and disadvantages of mongodb

Idea easy to use plug-in summary!!!

C语言课设学生选修课程系统(大作业)

SQL statement
随机推荐
mysql数据类型学习笔记
C语言课设职工信息管理系统(大作业)
【#Unity Shader#自定义材质面板_第二篇】
[summary of knowledge points] chi square distribution, t distribution, F distribution
idea 好用插件汇总!!!
Detailed steps for installing redis on Windows system
[postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
产品学习(二)——竞品分析
阿里OSS Postman Invalid according to Policy: Policy Condition failed: [“starts-with“, “$key“, “test/“]
[wechat applet] view container and basic content components
[unity shader custom material panel part II]
[self use of advanced mathematics in postgraduate entrance examination] advanced mathematics Chapter 1 thinking map in basic stage
子类调用父类的同名方法和属性
如果我在广州,到哪里开户比较好?究竟网上开户是否安全么?
Comment imprimer le tableau original
【微信小程序】视图容器和基本内容组件
网络爬虫
C语言课设学生信息管理系统(大作业)
Several ways of gson's @jsonadapter annotation
mysql学习