H5-Mobile-side adaptation

Source: Internet
Author: User

Before writing H5 page will also encounter the adaptation problem, is through the media query 1.1 point adjustment, always feel very cumbersome, but has not been to think of solutions.

It took me a whole morning to study today. niche is just stepping into the front road of the small white, for the online big guy's explanation is very laborious to understand it .....

But still found a simple solution, refer to the link: 78712328 (thank you very much);  

1!function(b, a) {2         varc =b.documentelement;3A =function() {4             varA =C.clientwidth;5A && (c.style.fontsize = a/375 * + "px")6         };7Window.addeventlistener ("Orientationchange"inchWindow? "Orientationchange": "Resize", A,!1);8B.addeventlistener ("domcontentloaded", A,!1)9} (document, window);

This method is used to change the size of the root element font-size dynamically, and to achieve the appropriate matching.

Through testing, the feeling of adaptation is still possible,

This is the first time to deal with it and to understand the rest of the practice.

  

H5-Mobile-side adaptation

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.