HTML5 + Study Notes 1 ------- reading Code while studying, html51 -------

Source: Internet
Author: User

HTML5 + Study Notes 1 ------- reading Code while studying, html51 -------

document.addEventListener('touchstart',function(){    return false;},true);

Touchstart is triggered when a finger touches the screen, even if one finger is already on the screen.

document.oncontextmenu=function(){    return false;};

Oncontextmenu

var _domReady=false;document.addEventListener('DOMContentLoaded',function(){    _domReady=true;    compatibleAdjust();},false);

Domready event, similar to jq's $ (document). ready ()

Var _ adjust = false; function compatibleAdjust () {if (_ adjust |! Window. plus |! _ DomReady) {return;} _ adjust = true; // if ('ios '= plus. OS. name) {document. getElementById ('content '). className = 'scontent';} // pre-create a second-level window // preateWebviews (); // close the startup interface setTimeout (function () {plus. navigator. closeSplashscreen ();}, 500 );}

// Adjust the compatibility Style

Var _ openw = null; function clicked (id, a, s) {if (_ openw) {return;} a | (a = ); _ openw = preate [id]; if (_ openw) {_ openw. showded = true; _ openw. show (a, null, function () {_ openw = null; // avoid clicking to open multiple pages quickly});} else {// var wa = plus. nativeUI. showWaiting (); _ openw = plus. webview. create (id, id, {scrollIndicator: 'none', scalable: false, popGesture: 'hide '}, {preate: true}); preate [id] = _ openw; _ openw. addEventListener ('loaded', function () {// display only after the foliar loading is complete // setTimeout (function () {// delayed display can avoid white screen animation on the low-end server. // wa. close (); _ openw. showded = true; s | _ openw. show (a, null, function () {_ openw = null; // avoid clicking to open multiple pages quickly}); s & (_ openw = null ); // avoid variable resetting in s Mode //}, 10) ;}, false); _ openw. addEventListener ('close', function () {// you can enable _ openw = null again after the page is closed; preate [id] & (preate [id] = null ); // close the compatible window}, false );}}

// Process click events

Var preate = {}; function preateWebviews () {preateWebivew ('plus/webview.html '); var plist = document. getElementById ('plist '). children; // because too many Webview windows are pre-created during startup, it takes a long time to create only five for (var I = 0; I <plist. length & I <2; I ++) {var id = plist [I]. id; id & (id. length> 0) & preateWebivew (id) ;}} function preateWebivew (id) {if (! Preate [id]) {var w = plus. webview. create (id, id, {scrollIndicator: 'none', scalable: false, popGesture: 'hide '}, {preate: true}); preate [id] = w; w. addEventListener ('close', function () {// you can enable _ openw = null again after the page is closed; preate [id] & (preate [id] = null ); // close the compatible window}, false );}}

 

 

// Clear the pre-created page (only) function preateClear () {for (var p in preate) {var w = preate [p]; if (w & w. showded &&! W. isVisible () {w. close (); preate [p] = null ;}}}

 

When developing a mobile App through HTML5, you will find that many HTML5 capabilities are not available. To make up for the lack of HTML5 capabilities, the www.HTML5Plus.org organization was established under the guidance of W3C China to launch the HTML5 + specification.

HTML5 + extends the JavaScript Object plus so that js can call a variety of browsers to achieve or achieve poor system capabilities, such as camera, gyroscope, and file system capabilities, business capabilities include upload and download, QR code, MAP, payment, voice input, and message push.

 

Related Article

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.