Home > front end >  The mouse drag promotion -- limit out
The mouse drag promotion -- limit out

Time:11-26

the mouse drag and drop to qualify limit out

Go to a continued study


Want to restrict out to the node. Style. The left and the node style. The top minimum value is set to 0 and then obtain the page window size
The first method
Var windowWidth=document. DocumentElement. ClientWidth | |. The document body. ClientWidth;//a compatible problem, I will be writing
Var windowHeight=document. DocumentElement. ClientHeight | |. The document body. ClientHeight;
The maximum width of high respectively
L=windowWidth - node. OffsetWidth;//the node in the upper left corner of the origin if not subtract the width of the node will be beyond the width of the whole node!!!!!!
T=windowHeight - node. OffsetHeight//same as above





The second method
Principle is still the same. Just use the Math min () and Math. The Max () method


When a line l l maximum value less than 0 0
When out of the line l l is greater than the windowWidth - node. OffsetWidth take the minimum windowWidth - node. OffsetWidth



Ditto

The source code



* * * * * * * * * * * * * * * * * * * * * * * * * * happy day to study and the end of the * * * * * * * * * * * * *

CodePudding user response:

Nice, come on

CodePudding user response:

  • Related