Quickly resolve jquery.touchswipe sliding and vertical scroll bar conflicts _jquery

Source: Internet
Author: User

In this paper, we share the solution of the conflict between the jquery.touchswipe and the vertical scroll bar, and the details are as follows

Just need HTML5 to do a function that can be switched around, but to retain the upper and lower scroll bar function. I am in the mobile end of the use of Jquery.touchswipe plug-ins, Internet search for a long time did not see the corresponding solution, can only modify their own, and finally can be used.

Let's go to the last picture:

The solution is that I add the left and right scrolling events to the body, and the top and bottom activities use the vertical scrolling of the div. Code on:

$ ("#body"). Swipe ({fingers: ' All ', Swipeleft:swipe1, swiperight:swipe2});
  function Swipe1 (event, direction, distance, duration, fingercount) {
   Tab_shipu (-1);//left-slide the action you want to perform 
  }
         
  function Swipe2 (event, direction, distance, duration, fingercount) {
    Tab_shipu (1);  Slide to the right the action you want to perform
  }

Then scroll up and down the bar I set div scrolling;

<div id= "Cook" class= "Cook" ></div>
<style>
  cook{
    overflow:auto;
</style>

Set the default height code for body and DIV:

$ ("Body"). CSS ("height", document.body.scrollHeight);
$ (". Cook"). CSS ("height", document.body.scrollheight-$ (' #cook '). Position (). top);

The above is to solve the left and right sliding and vertical rolling conflict of the method, I hope to help you learn.

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.