Mobile web App Development Memo

Source: Internet
Author: User

In the near future to make a mobile phone HTML5 page, do some knowledge reserves, important points recorded to prepare for perhaps.

1.devicePixelRatio: Defines the ratio of the physical pixel of the device to the independent pixel of the device. The PX in CSS can be viewed as a separate pixel of the device. Through Devicepixelratio. It is possible to know how many physical pixels a CSS pixel on the device represents, and to consider Devicepixelratio+rem to fit between different devices;

2. Using the image object to implement lazy loading of the picture, the main logic code such as the following:

var len = Queue.length;var counter = 0;for (var i = 0; i < len; i++) {var img = new Image (); img.src = Zepto (Queue[i]). dat A ("url"); img.onload = function () {counter++;if (counter >= len) {logic.onloadcomplete ();}}}
Creates a new image object with new image and listens for its onload event, which is loaded after loading is complete.

3.zepto.js. Designed for mobile web development, smaller and lighter. The API is similar to jquery. Chinese Brochure Address: http://www.html-5.cn/Manual/Zepto

4.SVG vs Canvas. Two kinds of HTML5 browser drawing technology.

SVG draws images that are DOM elements and therefore supports event handling, and each update of the canvas needs to be redrawn. And SVG supports animations and filters.

For the implementation of animations, canvas is constantly redrawing artboards. And SVG is native-supported.

5. Only Scrollstart,scrollend,refresh events are implemented in the source code of the ISCROLL5,ISCROLL5. Without scrolling, the event can be resolved by adding a sentence to the source code:

This._execevent (' Scrollmove ');  
Added to the source code after the _move:function. This will trigger the event at the end of the _move, allowing for monitoring.



Mobile web App Development Memo

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.