Solution to fixed position of mobile browser in CSS

Source: Internet
Author: User


First of all, the development model, just started to contact, basically follow the web-side development mode, the current development model did not find suitable, now basically like this:
1, computer Nginx Configure server
3, computers and mobile phones together with a local area network,
2,android root and the iphone jailbreak to bind hosts, access to the Computer configuration environment.
However, the Uc,qq browser cache is serious, and the changes to the hosts file are indifferent. You must not modify the file to the outside of the net every time, debugging is quite troublesome.

One problem is that some do not support fix positioning at all, this is only binding JS Touchmove event compatible.
The most troubling is not full support.
The first problem is that you cannot have position:relative or absolute elements within the element where fix is positioned, and if so, these elements are not limited by the fixed ancestor element, and are positioned according to the body, Scroll to the bottom when scrolling along with the fixed element. The solution is to remove those positions and replace them with other positioning methods.
Another problem fix positioning, Fix's floating layer does not appear at all, only to scroll to the bottom of the display, and then the normal fixed positioning. This layer is JS dynamic Add, I have tried in js El.style.display = ' None '; el.style.display = ' block '; But there is no effect, the final solution is to set display:none in CSS; Then the dynamic insertion of the body after setting Style.display = ' block ';
After solving this problem, there is another problem is that the fix layer can be clicked without scrolling, but after scrolling click on this layer does not respond, this layer will be through like set: Pointer-eventes:none; , click to the next layer of the layer. The solution to this is
The user-scalable=no will be added in viewport:

The code is as follows Copy Code

<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>

Become:

The code is as follows Copy Code

<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0 User-scalable=no "/>

Well, fix positioning basic these.

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.