[Original] fixed positioning head beat and iosfixed in IOS compatibility APP

Source: Internet
Author: User

[Original] fixed positioning head beat and iosfixed in IOS compatibility APP

Compatibility:

In the webview of the App, we sometimes write custom headers on the page, and use fixed to locate them. The effect we want is that the page slides no matter how it slides, this custom header is always fixed on the top, but in ios 11 or later versions, the problem arises. When we slide the page quickly, during Page scrolling, the head of the fixed positioning will slide along the page. The head will only appear after the slide operation is completed. This problem is not found in Android and iOS 11 or earlier versions.

Solution:

Directly control the page in a box to slide, and the head is absolutely positioned relative to the box. However, the side effect of such writing is that except for the element named wrapper, The scrollTop attribute value of other elements is always 0.

<Div class = "box" style = "position: absolute; top; 0; left: 0; right: 0; bottom: 0;-webkit-overflow-scrolling: touch; "> <div class =" head "style =" position: absolute; top; 0; left: 0; right: 0; "> Head </div> <div class =" wrapper "style =" position: absolute; top; 0; left: 0; right: 0; bottom: 0; overflow-y: scroll; "> <div class =" content "> <p> para </p>... <p> para </p> </div>

 

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.