Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
    <head>
        <!meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" href="lib/onsen/css/onsenui.css"/>
        <link rel="stylesheet" href="lib/onsen/css/onsen-css-components.css"/>
        <script src="lib/onsen/js/onsenui.js"></script>        
        <title>Hello World</title>
    </head>
    <body>


        <ons-page id="tabbarPage">
            <ons-tabbar id="myTabbar" position="bottom" animation="none" >
                <ons-tab page="hiddenpage.html" label="Hidden" style="display:none">
                </ons-tab>
                <ons-tab page="1.html" label="Tab1">
                </ons-tab>
                <ons-tab page="2.html" label="Tab2" active>
            </ons-tabbar>          
        </ons-page>
    <ons-template id="1.html">
        <ons-page id="tab1">
            <ons-toolbar>
                <div class="center">
                    <font color="#0076ff" >TAB1</font>
                </div>
            </ons-toolbar>
            <div>

            </div>
        </ons-page>
    </ons-template>
    <ons-template id="2.html">
        <ons-page id="tab2">
            <ons-toolbar>
                <div class="center">
                    <font color="#0076ff" >TAB2</font>
                </div>
            </ons-toolbar>
            <div>

            </div>
        </ons-page>
    </ons-template>
    <ons-template id="hiddenpage.html">
        <ons-page id="hiddenpage" >
            <ons-toolbar>
                <div class="center" >
                    <font color="#0076ff" >HIDDEN</font>
                </div>
            </ons-toolbar>

            <div>
            </div>
        </ons-page>
    </ons-template>

        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
    </body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                /*
 * 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 may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on 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() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        document.addEventListener("resume", this.onResume.bind(this), false);
        this.receivedEvent('deviceready');
    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        console.log('Received Event: ' + id);
        document.getElementById("myTabbar").setActiveTab(1);
        console.log(document.getElementById("myTabbar").getActiveTabIndex());
    },
    onResume: function(){
        console.log(document.getElementById("myTabbar").getActiveTabIndex());
    }
};

app.initialize();
              
            
!
999px

Console