当前位置:网站首页>Day33 JS note event (Part 2) September 28, 2021
Day33 JS note event (Part 2) September 28, 2021
2022-06-28 11:30:00 【Little dream of becoming a big man】
The event type under the event object : e.type - Back to the event such as :click contextmenu

Mouse information under the event object :e.button (- 0 The left mouse button - 1 The wheel of the mouse - 2 Right mouse button )

The keyboard code under the event object :e.keyCode ( Enter key 13 - Space 32 - The up and down or so 37 38 39 40- Numbers and letters correspond ASCII)

Get and set the position and size of the element :
- offsetTop/offsetLeft The distance from the element to the top and left of the browser (margin And positioning effects )
- offsetWidth/offsetHeight Width and height of elements ( contain content+padding+border) margin It doesn't contain
- clientWidth/clientHeight Width and height of elements ( contain content+padding) It doesn't contain border and margin
Get the mouse coordinates :
- offsetX/offsetY The position of the mouse inside the element box ( Not affected by any attribute )
- clientX/clientY The coordinate position of the mouse relative to the browser ( Pages with scrollbars are not affected , Visual area coordinates )
- pageX/pageY The coordinate position of the mouse relative to the browser ( The page is affected when there is a scroll bar , Add the space between the scrollbars )

Restrict elements from dragging within a range :
- Get the width and height of the current browser document.documentElement.clientHeight/clientWidth
Get the width and height of the element box
- clientHeight/clientWidth Without Borders
- offsetWidth/offsetHeight With borders

Block default events :
- Add... At the end of the event method function return false
- e.preventDefault() Method of event object
- Compatible writing : e.returnValue = false

Event delegation :e.target ( Delegate your own affairs to the parent )

Mouse out move in event :
- onmouseover/onmouseout Trigger bubbling
- onmouseenter/onmouseleave Does not trigger bubbling

边栏推荐
- Industry analysis - quick intercom, building intercom
- mysql-.sql文件钓鱼上线
- 工作组环境下的内网渗透:一些基础打法
- Graduation season, some suggestions for you who are new to the society
- Zero foundation self-study SQL course | if function
- Training notice | special training notice on epidemic prevention and security prevention for overseas Chinese funded enterprises, institutions and personnel in 2022
- JS基础10
- 近况
- 一套十万级TPS的IM综合消息系统的架构实践与思考
- Oracle 日期格式化异常:无效数字
猜你喜欢

js中this的默认指向及如何修改指向 2021.11.09

科研丨Web of Science检索技巧

Fancy features and cheap prices! What is the true strength of Changan's new SUV?

vsftpd服务的部署及优化

New listing of operation light 3.0 - a sincere work of self subversion across the times!

如临现场的视觉感染力,NBA决赛直播还能这样看?

阿里三面:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别

JS基础8

动态库(共享库)的制作和使用

QML控件类型:TabBar
随机推荐
元宇宙系统的发展与原理介绍
day34 js笔记 正则表达式 2021.09.29
ThreadLocal的简单理解
Recommended practice sharing of Zhilian recruitment based on Nebula graph
合约量化系统开发(搭建讲解)丨合约量化系统开发(源码解析及现成案例)
Docker modifies the user name and password of MySQL
day37 js笔记 运动函数 2021.10.11
BigDecimal 类的 compareTo() 和 equals()方法
For example, the visual appeal of the live broadcast of NBA Finals can be seen like this?
JS基础4
Oracle 日期格式化异常:无效数字
Jetpack Compose Desktop 桌面版本的打包和发布应用
This Exception was thrown from a job compiled with Burst, which has limited exception support. 报错
如临现场的视觉感染力,NBA决赛直播还能这样看?
Making and using of static library
GEE:基于 MCD64A1 的 GlobFire 日常火灾数据集
day29 js笔记 2021.09.23
MySQL cannot query the maximum value using the max function
远程登录sshd服务
JS基础5