About mobile gesture swipe and pull-up loading drop-down refresh simple analog notes

Source: Internet
Author: User

I contact the front end soon, write bad please advice, welcome to point out

Recently to achieve a demand needs to realize mobile gesture operation, there are many good plug-ins found on the Internet (PS: Do not advertise, a search a lot of)

Plug-in is really good, but I want to study, then wrote a demo, to achieve the pull, pull trigger, and left and right gesture swipe trigger

Pull, pull-down trigger.

$ (window). Scroll ()//trigger when scroll bar is scrolled

ScrollTop () (height of scroll bar from top)

$ (document). Height (the total height of the current page)

$ (this). Height (the currently visible page height);

Please see the attached code below for details.


Left and right gesture swipe trigger

Using JS's AddEventListener monitor,

Listen to-touchstart events, Touchmove events, touchend events, and get the Clientx,clienty properties separately

Touchstart: Triggers when the mouse taps the screen
Touchmove: Triggers when the mouse moves through the screen
Touchend: Triggers when the mouse leaves the screen

Property: Event.touches[0].clientx,event.touches[0].clienty get x, y coordinates

Directly on the code, please advise (PS: Please use the mobile mode debugging)

<! DOCTYPE html>

  

About mobile gesture swipe and pull-up loading drop-down refresh simple analog notes

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.