How to troubleshoot problems with mobile fixed elements not appearing

Source: Internet
Author: User
This article introduces to you about how to solve the mobile fixed element does not display the problem, there is a certain reference value, the need for friends can refer to, I hope to help you.

A few weeks to the company app made a HTML5 nested page, the page is not complex, more content, the bottom of the footer

The HTML structure is as follows

<style>  . main{    Position:absolute;    top:0;    bottom:88px;    left:0;    width:100%;    Overflow-y: auto;  }  footer{    position:fixed;    left:0;    bottom:0;    width:100%;  } <style><body>  <div class= "main" >    ...  </div>  <footer></footer></body>

After the content debugging was done, I inserted some other items, and then the app developer told me to listen to the page scroll let me not use the positioning layout. I see there is no place to enter on the page, there will be no fixed elements run out of things. So the main part is changed to the normal layout, then the bug is:
Everything is OK on Android, IOS10 on the page sometimes footer not show, drag or double-click after the display (other versions of the iOS test that is normal)

The first idea of this problem is to turn the footer Z-index up to 1000, and the result is useless. Carefully observe the pages that are not displayed their content is very short, not to support the position of the footer, conjecture is the body height problem, the body plus style debugging

Background: #fafafa; MIN-HEIGHT:100VH;

The entire page background is actually dimmed, but footer still doesn't show

After discussion with colleagues, guess is that the phone rendered a hierarchy problem, at first footer not rendered, click or Touchmove after the page re-render footer normal.
It was already near the line, in order to solve the bug as soon as possible, to footer set up a tanslatez, so the equivalent of creating a separate level

-webkit-transform:translatez (1px) transform:translate (1px)

There are also 1 layers on the page that are set to z-index,footer with translate layers, indicating a higher level of tranzlatez. The Translatez (2px) of the projectile layer is normal.
This method is not very elegant, but the benefits are not changed in the layout, when the situation is urgent to apply

Related articles recommended:

Introduction to the Holy Grail layout and the two-wing layout in CSS (with code)

How to implement floating element wrapping in CSS

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.