In jquery, we can use MouseDown, MouseUp to track the mouse press and release events of the page.
How to get the position information of the mouse. The Pagex and Pagey properties of event events allow us to get the exact position of the mouse in the page, equivalent to the XY coordinates in the mathematical coordinate system.
So we can first use a global variable to record the location of the mouse position information, and then in the mouse release function to determine whether the position and release of the position is consistent, and then according to the results of the operation.
The sample code is as follows:
var x, y;
$ (document). MouseDown (Event) {//Gets the position of the mouse pressed
x = Event.pagex;
y = event.pagey;
});
$ (document). MouseUp (function (event) {//mouse release
var newx = Event.pagex;
var newy = Event.pagey;
if (x==newx && y==newy) {
//Position same action
}
else{
//position different operation
}
})
————————————————————————————————————————————————— – Java Architect Project Combat, high concurrency cluster distributed, big Data high availability video tutorials, total 760G
Download Address:
https://item.taobao.com/item.htm?id=562739965822
01. High Level architect 42 stages
02.Java Advanced System Training Architecture Course 148 hours
03.Java Advanced Internet Architect Course
04.Java Internet Architecture Netty, Nio, Mina, etc.-Video tutorial
05.Java Advanced Architecture Design 2016 finishing-video tutorial
06. Architect Foundation, advanced film
07.Java architect compulsory Linux operations series course
08.Java Advanced System Training Architecture Course 116 hours
+
Hadoop series tutorials, Java design patterns and data structures, Spring cloud microservices, Springboot Primer
—————————————————————————————————————————————————–