Based on Hbuilder Development mobile app-Home/jump page/Toggle tab

Source: Internet
Author: User

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>

4

Based on Hbuilder Development mobile app-Home/jump page/Toggle tab

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.