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