当前位置:网站首页>图解事件坐标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:鼠标点击位置相对于触发事件对象的垂直距离
三、事件对象参数
边栏推荐
- 【#Unity Shader#Amplify Shader Editor(ASE)_第九篇】
- 问题:OfficeException: failed to start and connect(二)
- RestTemplate使用
- Async and await
- Terminology description in the field of software engineering
- 软件工程复习
- Is the account opening of Huafu securities safe and reliable? How to open Huafu securities account
- 如果我在广州,到哪里开户比较好?究竟网上开户是否安全么?
- 基金定投是高风险产品吗?
- 第五章 輸入/輸出(I/O)管理
猜你喜欢
Some pits designed by NOC
[wechat applet] to solve button, input and image components
2022 年江苏省职业院校技能大赛(中职) 网络搭建与应用赛项公开赛卷
[ITSM] what is ITSM and why does it department need ITSM
idea 好用插件汇总!!!
B-tree series
Application of IT service management (ITSM) in Higher Education
【微信小程序】如何搭积木式开发?
[unity shader custom material panel part II]
MySQL learning
随机推荐
脏读、幻读和不可重复读
产品学习(三)——需求列表
子类调用父类的同名方法和属性
Comment imprimer le tableau original
C语言课设物业费管理系统(大作业)
码力十足学量化|如何在财务报告寻找合适的财务公告
2022 Jiangsu Vocational College skills competition (secondary vocational school) network construction and application open competition volume
[postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
C语言课设学生考勤系统(大作业)
Rotate the animation component around the circle, take it and use it directly
伪装请求头库: anti-useragent
HCM Beginner (IV) - time
DML statement in SQL (data operation language)
Promise
虚幻 简单的屏幕雨滴后处理效果
数据库对象:视图学习记录
Teach you how to implement a deep learning framework
ManageEngine Zhuohao helps you comply with ISO 20000 standard (IV)
Terminology description in the field of software engineering
Notes on probability theory