Mobile Development Tips

Source: Internet
Author: User

1, page meta of the viewport

<name= "Viewport"  content= "Initial-scale=1.0,user-scalable=no, Maximum-scale=1,width=device-width ">
Width is wide, Initial-scale initializes the scale
Maximum-scale maximum scale allowed for user scaling
Minimum-scale minimum scale allowed for user scaling
User-scalable whether the user is allowed to zoom

2. Turn off auto-capitalization of iOS keyboard first letter
iOS, the default English input method state, the first letter is automatically capitalized, sometimes quite annoying, if you want to turn off the automatic capitalization can be achieved through the Autocapitalize property:

<type= "text"  autocapitalize= "Off"/>

3. Turn off iOS input auto-correction

If you don't need it, you can:

<type= "text"  AutoCorrect= "Off"/>

4. Prohibit text scaling

The size of the text is recalculated when the mobile device is switched between the screen and the other, and is scaled accordingly, and when we don't need this, we can choose to disallow:

{    -webkit-text-size-adjust: 100%;}

5. How to clear the shadow in the input box on the mobile side

On iOS, the input box defaults to an inner shadow, but cannot be cleared using Box-shadow, which can be turned off if no shadow is needed:

{    border: 0/**/    -webkit-appearance:  None/**/}

6, e-mail address identification

Turn off email address recognition:

Turn off email address recognition: <  name= "format-detection"  content= "Email=no"/>  Open Mail:<mailto:[email protected] ">[email protected]  </a>

7, mobile phone number identification

In IOS Safari (no other browsers and Android), the numbers that look like phone numbers are treated as phone links, such as:
* 7 digits, shaped like: 1234567
* Numbers with brackets and plus signs, shaped like: (+86) 123456789
* Number of double connection lines, shaped like: 00-00-00111
* 11 digits, shaped like: 13800138000

1. Turn off phone recognition:<Metaname= "Format-detection"content= "Telephone=no" />2. Turn on the phone function:<ahref= "tel:123456">123456</a>3. Turn on the SMS feature:<ahref= "sms:123456">123456</a>

8. Fast Rebound scrolling

Let's take a look at the history of rebound scrolling in mobile browser development:
* In the early days, the mobile browser does not support the non-body elements of the scroll bar, so generally with the help of Iscroll;
* Android 3.0/ios solves the scrolling problem of non-body elements, but the scroll bar is not visible, while iOS can only scroll through 2 fingers;
* Android 4.0 solved the scroll bar is not visible and added a quick rebound scrolling effect, but then this feature was removed;
* iOS starting from 5.0 solved the scroll bar is not visible and added a quick rebound scrolling effect
On iOS If you want an element to have a scrolling effect like Native, you can do this:

{    overflow: Auto/**/     -webkit-overflow-scrolling: Touch;}

Ps:iscroll used to feel not very good, there are some strange bugs, here is recommended another Idangero Swiper, this plug-in integrates the powerful function of sliding screen scrolling (support 3D), but also has a rebound scrolling built-in scroll bar, the official address:
http://www.idangero.us/sliders/swiper/index.php

9. Disable selection on the mobile side

If you don't want the user to be able to select the content on the page, you can disable it in the CSS:

{    -webkit-user-select: none;}

10. Remove touch highlighting from the mobile side
When you do the mobile page, you will find all a tags in the trigger click or all set Pseudo-class: Active elements, the default will be in the active state, the display of the Highlight box, if you do not want this highlight, then you can use the following CSS methods to suppress:

{    -webkit-tap-highlight-color:rgba (255,255,255,0) can simultaneously mask the shadows that appear when an iOS hits an element. }

11. How to prohibit saving or copying images

Usually when you press and hold the image img on your phone or pad, the option to store the image or copy the image will pop up, and if you don't want the user to do so, you can disable it in the following ways:

{    -webkit-touch-callout: none;}

12. Animation acceleration

-webkit-transform:translate3d (0, 0, 0)

With iOS you can make the animation smoother (this property calls Hardware acceleration mode), but it's not possible to use Android to create a lot of unseen bugs.

Mobile Development Tips

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.