1. Meta tags to add to the page header
<meta name= "viewport" content= "Width=device-width,user-scalable=no"/>
<!--QQ Force horizontal screen or vertical screen
Portrait vertical Screen
Landscape horizontal Screen
X5 Browser: QQ Browser, QQ built-in browser
-
<meta name= "x5 orientation" content= "Portrait"/>
<!--QQ settings fullscreen--
<meta name= "X5-fullscreen" content= "true"/>
<!--UC to force vertical or horizontal screen display-
<meta name= "Screen-orientation" content= "Portrait | Landscape "/>
<!--UC Fullscreen display-
<meta name= "Full-screen" content= "yes"/>
<!--prohibit identification of phone numbers and mailbox numbers--
<meta name= "format-detection" content= "Telephone=no,email=no"/>
2.rem adaptation
Page header Add this line code the original size divided by 100
e.g. 100px=1rem;
<script>
var iscale = 1/ window.devicepixelratio; var iwidth = document.documentElement.clientWidth; document.getElementsByTagName (' html ') [0].style.fontsize = iwidth/7.5 + ' px ';
</script>
3.js Native Mobile Events
Basic event: touchstart //trigger when finger is just touching the screen touchmove //finger is triggered when moving on screen touchend //finger is triggered when moving away from the screen touches //List of all fingers on the screen targettouches //List of all fingers on the element changedtouches // List of all fingers that involve the current event each event has a list, and each list has the following properties: where coordinates are used Pagex,pagey:pagex //relative to the X-coordinate of the page pagey // Relative to the y-coordinate of the page Clientx //relative to the viewport's x-coordinate clienty //relative to the viewport's y-coordinate screenx //relative to the x-coordinate of the screen Screeny //relative to the y-coordinate of the screen &NB Sp;identifier//The unique number of the current touch point target //The DOM element touched by the finger simple Trigger time Demo
<script type= "Text/javascript" > var obox=document.getelementbyid ("box"); var off=document.getelementbyid ("Off"); Off.addeventlistener (' touchstart ',function() { OBox.style.display= "None"; } , false)</script>
Mobile side of the miscellaneous