Tab:view ges element Tab ble text eve hbuilder push
Objective
Mobile app
Front-end language learning, shun with learning to make mobile app, here to share with you, my first mobile app, its name is Hello, tomorrow. The app is a copy of the phone on the QQ reading production, you can log in, view the novel some simple design, because just contact a lot of things need to slowly familiar, perfect, the shortcomings please forgive me.
Opening
Download Hbuilder here does not do too much elaboration, directly into the topic.
1 Creating a new project-mobile app |
First come to a town building:
When you create a new project will appear, the creation of the time to select the MUI project, which will contain some CSS and JS convenient to write content.
Specific content and homepage such as:
2 Setting up the bottom tab |
Change what you need to change in the appropriate location as follows:
3 Creating the required sub-pages
|
The required sub-page one by one corresponds, writes an array, in JavaScript Mui.plusready writes to the phone side of the preparation requirements, the internal write function:
Here I am using preload: plus.webview.create (Objye[i],objye[i],objstyle);
Since the use of the self-loading function, the page starts with a direct preload of four pages, the initial default effect through: Mui.trigger (arr[0], "tap"); Implement default Click Effect of the First tab.
When each tab is clicked, Other tab content is displayed with its own sub-page WebView display, other hidden: based on the For loop inside the self-loading function. This achieves the effect of a jump page.
<script type= "Text/javascript" >mui.init () Mui.plusready (function () {var arr =document.getelementsbyclassname ( "Mui-tab-item"); var objye = ["main.html", "second.html", "third.html", "fourth.html"];var objstyle = {top: "0px", Bottom: "51px",};var objs=[];var self = plus.webview.currentWebview ();//Take the current home window for (var i=0;i<arr.length;i++) {! function (i) {var obj = plus.webview.create (Objye[i],objye[i],objstyle); Objs.push (obj); Arr[i].addeventlistener ("Tap ", function () {for (Var j=0;j<arr.length;j++) {if (j!=i) {objs[j].hide ()}else{objs[j].show ()}} self.append (Objs[i]) })} (i)} mui.trigger (Arr[0], "tap"); }) </script>
Based on Hbuilder Development mobile app-Home/jump page/Toggle tab