Disable method that Overflow:hidden page also scrolls when the mobile side is set

Source: Internet
Author: User
Today in the work encountered a very embarrassing problem, the following article is mainly about the mobile side set up Overflow:hidden, but the page will still scroll the prohibition method, the text through the sample code introduced in very detailed, the need for friends can reference, the following to see together.

Objective

This article mainly introduces to you on the mobile side set the overflow:hidden page will also scroll the prohibition method, share out for everyone to reference the study, the following words do not say, come together to see the detailed introduction bar.

If you overflow:hidden use the body tag, the mobile browser can still scroll because the mobile is based on the touch event and there are two workarounds.

Method One:

To hide the scrolling content plus a wrap layer p, and then set the height for this p window.height() , and overflow:hidden you can solve your problem.

Method Two:

To add an position:fixed; example to body:


body {overflow:hidden; position:fixed; left:0; top:0;}
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.