About Mobile swipe gestures

Source: Internet
Author: User

Background:

Based on the mobile side of the project to be tried, there is a need to have a pull down gesture to load different data, which involves sliding gestures and Ajax data loading knowledge points. Therefore, the whole realization process to do a record collation. Personal JS Limited, read a lot of examples and the mobile gesture knowledge point combing the technical blog to achieve the realization of the function. And in the process, it was only a preliminary understanding of the mobile framework Zepto.js. _ (: З"∠) _ Of course, at the end of the choice is to use the original to achieve this function, only because this is able to understand the overall function of the principle of understanding more fully, and want to rely less on plug-ins. However, on the data load, because of the cost of time and so on, and finally the use of jquery to achieve the part of Ajax.

Description: To load the previous or next week data information for the current week page by swiping down or up by one finger, data refresh on the previous or next week.

Implementation: 1. Gets the coordinates (x, y) when the finger touches the screen;

2. Under the premise of limiting one-finger touch, obtain the coordinate position of the finger in the screen after moving (X1,Y2);

3. Use if to control the vertical and horizontal numerical differences between coordinates (x, y) and end coordinates (X1,Y2), limiting the sliding range;

4. Eligible to load the corresponding specified data.

RELATED links:

Native JS implements touch-slip event http://dobit.top/Detail/109.html

Play turn H5 pull down slide effect https://isux.tencent.com/h5-drop-down-effect-slide.html

Open source Mobile element drag inertia bounce and pull load two JS http://www.zhangxinxu.com/wordpress/2017/01/mobile-phone-drag-drop-inertia-loading/

The basic is to simplify the native JS implementation of touch-slip event code to achieve sliding motion. And the control of the if aspect needs to be improved on its own. And the other two examples have a place for me to inspire. And the two examples of the relevant explanations are also very detailed, is worth recording.

About Mobile swipe gestures

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.