Mobile side of the miscellaneous

Source: Internet
Author: User

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

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.