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;}