Cannot forget gesture events on the mobile side

Source: Internet
Author: User

have been free to develop Web sites on the PC, of course, I also made the site into a responsive.

But have not studied mobile gestures, the last interview in Ctrip a topic is now deeply engraved in my mind:

What to do with the swipe event on your phone, like a common app swipe to the right to appear on the menu?

Today, Hammer.js studied, she mainly handles mobile gesture events, just as her ad:add touch gestures to your page.

My train of thought:

1. When the finger slides to the right, the left block moves right

2. Left is hidden when the finger is sliding in the red

The code is as follows:

<! DOCTYPE html>
  

 

Example effect: http://2.liteng.sinaapp.com/javascript/hammer.html

The main idea is to walk in two steps:

1. Create an instance var mc = new Hammer (myelement);

2. Bind the example binding event Mc.on ("Panleft/panright/tap/press", FTN);

Study Official website: http://hammerjs.github.io/

Original address: Http://liteng.org/node/40

Cannot forget gesture events on the mobile side

Related Article

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.