<! DOCTYPE html><!--Licensed to the Apache software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); You are not a use of this file except in compliance with the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable law or Agreed to writing, software distributed under the License are distributed on a "as is" BASIS, without warranties OR CON Ditions of any KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!----introducing jquery----! > <script type= "text/javascript" src= "Js/jquery-2.2.4.min.js" ></script> < ;! --Introduce sliding third-party libraries, let the list slide--<script type= "Text/javascript" src= "Js/iscroll-lite.js" ></script> <script Typ E= "Text/javascript" src= "cordova.js" ></script> <script type= "Text/javascript" src= "Js/index.js" > </script> <title>hello world</title> Index.css:
/* * Licensed to the Apache software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * Distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * under the Apache License, Version 2.0 (The * "License"); You are not a use of this file except in compliance * with the License. Obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * unless required by applicable l AW or agreed to writing, * software distributed under the License are distributed on A * "As is" BASIS, without WARRANT IES or CONDITIONS of any * KIND, either express OR implied. See the License for the * Specific language governing permissions and limitations * under the License. */* {-webkit-tap-highlight-color:rgba (0,0,0,0);/* Make transparent link selection, adjust last value opacity 0 to 1. 0 */}.head{Position:absolute; left:0; right:0; top:0; Height:2rem; Line-hEight:2rem; Background-color:orange; Padding-left:.3rem; Color:white; Text-align:center;}. content{Position:absolute; Top:2rem; bottom:0; left:0; Right:0}.content. nav{Position:absolute; top:0; Height:1.5rem; left:0; right:0; Background: #efefef;}. Content. list{Position:absolute; Top:1.5rem; left:0; right:0; bottom:0; Background: #adadad; Overflow:hidden;}. Content ul{List-style:none; padding:0; margin:0;}. Content ul li{position:relative; Height:2rem; Padding-left:. 5rem; border-bottom:1px solid Gray; Background:white;}. Content ul li.touchinside{background: #efefef;}. Content ul Li. file-icon{position:absolute; Background:url (".. /img/file.png ") No-repeat Center; Background-size:1.2rem 1.2rem; Width:1.2rem; Height:1.2rem; Left:1rem; Top:.3rem;}. Content ul Li. file-name{position:absolute; Line-height:2rem; Left:3.2rem;}Index.js:
/*
* Licensed to the Apache software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* Distributed with the additional information
* Regarding copyright ownership. The ASF licenses this file
* To you under the Apache License, Version 2.0 (the
* "License"); Except in compliance
* with the License. Obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable or agreed to writing,
* Software distributed under the License is distributed in an
* ' As is ' BASIS, without warranties OR CONDITIONS of any
* KIND, either express or implied. See the License for the
* Specific language governing permissions and limitations
* Under the License.
*/
var app = {
Application Constructor
Initialize:function () {
This.bindevents ();
},
Bind Event Listeners
//
Bind any events is required on startup. Common events are:
' Load ', ' deviceready ', ' Offline ', and ' online '.
Bindevents:function () {
Document.addeventlistener (' Deviceready ', This.ondeviceready, false);
},
Deviceready Event Handler
//
The scope of the "This" is the event. In order to call the ' receivedevent '
function, we must explicitly call ' App.receivedevent (...); '
Ondeviceready:function () {
App.receivedevent (' Deviceready ');
},
Update DOM on a Received Event
Receivedevent:function (ID) {
var parentelement = document.getElementById (ID);
var listeningelement = Parentelement.queryselector ('. listening ');
var receivedelement = Parentelement.queryselector ('. Received ');
Listeningelement.setattribute (' style ', ' display:none; ');
Receivedelement.setattribute (' style ', ' display:block; ');
Console.log (' Received Event: ' + ID);
}
};
App.initialize ();
$ (function () {
var size = $ (window). Width ()/18
Design font Width
$ (' HTML '). CSS (' font-size ', size);
var myscroll = new Iscroll ("#file-list");
Attachevent ($ (' li '), function () {
$ (this). Remove ();
})
});
function attachevent (SR, CB) {
var _this = $ (this);
var timeid = null;
Click event response time is 300 milliseconds
The finger is pressed and if the finger moves, the cancellation is triggered
Sr.unbind ();
Sr.on (' Touchstart ', function () {
_this.data (' Touch ', true);
var me = $ (this)
Design Timeid If you swipe at the point, you don't have to trigger.
Timeid = SetTimeout (function () {
Me.addclass (' touchinside ');
},100);
})
Sr.on (' Touchend ', function () {
Cleartimeout (Timeid);
if (_this.data (' Touch ')) {
The this pointer that changes the callback function is SR
Trigger callback function
Cb.bind (this) ();
}
$ (this). Removeclass (' Touchinside ')
_this.data (' Touch ', false);
})
Sr.on (' Touchmove ', function () {
Cleartimeout (Timeid);
_this.data (' Touch ', false);
$ (this). Removeclass (' Touchinside ')
})
}
Mobile Hybrid Development Page layout