JavaScript Judge mobile app gesture swipe screen orientation
Source: Internet
Author: User
<span id="Label3"><p><strong>Program Ideas:</strong></p><p>1. Sliding screen Events use HTML5 's Touchstart to slide the start event and the Touchend slide end Event.</p><p>2, the direction of the judgment, the starting point to do a plane coordinate system, and the end line to do straight lines, straight and x positive half axis calculation angle; We split the line at a 45-degree angle, such as: as long as the sliding angle is greater than or equal to 45 degrees and less than 135 degrees, It is determined to slide Upward.</p><p>3. Use math.atan2 () to calculate the line angle formed by the starting point and end Point.</p><p>4, carefully contrast the standard coordinate system and the screen coordinate system, we found that the standard coordinate system, the upper half axis is negative, to achieve the conversion, only need to change the y-coordinate starting point and finally Position.</p><p><strong>Code implementation:</strong></p><p></p><p></p><p>[online reference]:http://m.blog.csdn.net/blog/u011004053/33741859</p><p></p><p>JavaScript Judge mobile app gesture swipe screen orientation</p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service