How to use js to control the display of the PC page to the mobile side is the overall zoom? Http://www.majesticcreekcc.com/ is similar to this website.

now I want to make a PC page with exactly the same layout as the mobile page, but I don"t know how to control the page zooming. http://www.majesticcreekcc.co.

Mar.23,2021

this requirement does not need to write adaptation, directly access the pc version, the mobile browser can zoom the full screen.
if you have to zoom, use js to monitor the width-to-height ratio of the screen, and then use the scale property of css3 to zoom accordingly.

calculate page magnification: magnification = logical resolution / physical resolution of the screen
logical resolution is obtained by window.screen.width,
physical resolution is obtained by window.screen.width * window.devicePixelRatio,

scale (magnification);


  <meta name="viewport" content="width=device-width, initial-scale=0,user-scalable=no,maximum-scale=1.0">

add this to each html header, mine is fine


there is no need to zoom, only the resolution of the mobile device meets the requirements.

Menu