GithubHelp home page GithubHelp logo

iphone-css-mockup's Introduction

Iphone js app platform

This project contains an iphont css mockup and the js class for rapid iphone apps development.

Project structure:

  • root /
    • css/ - global css (iphone, color picker)
    • img/ - just favicon
    • js/
      • colorDockBar/ - simple app that allows to cange the iphone case color
      • iphone/
        • apps/ - contains the apps codes and data (css, imgs, js and whatever they need to work)
        • Application.js - app framework class
        • iphone.js - class that represents iphone hardware behavior (home button, power button) main.js - entry point of the page
    • index.html

Hello world app:

Register your app in the iphone:

  1. Create new folder HelloWorld in js/iphone/apps folder
  2. In HelloWorld folder create file HelloWorld.js add some image named HelloWorld.png (it'll be your app icon) and add HelloWorld.css Your folder should look like this:

folder and 3 files inside

  1. In index.html insert <script src="js/iphone/apps/HelloWorld/HelloWorld.js"></script> before main.js script
  2. In js/main.js add new app in apps array
{
    name: 'HelloWorld', // Your app name (must be the same as your app folder name)
    app: HelloWorld, // Yor app class name (Will be described below)
    position: [0,0], // Your app icon position in iphone launcher
}

Then you can write your app conde:

  1. Open your HelloWolrd.js
  2. Add this code:
class HelloWorld extends Application
{
    init (screen)
    {
        // Load Your app CSS code
        this.loadLib('js/iphone/apps/HelloWold/HelloWorld.css');

        // Your app HTML that will be inserted in iphone screen
        this.component = `
            <div class='app-container' style='background-color: white;'>
                <h1 id='myH1'>Hello world!</h1>
                <button id='myButton'>Click</button>
            </div>`;

        // This conde inserts your app HTML in iphone screen
        this.loadComponent(screen);
        
        
        // Here you can write code for your html
        // example:
        var myButton = document.getElementById('myButton');
        myButton.onclick = function(event) {
            var myH1 = document.getElementById('myH1');
            myH1.innerText = 'Hi!';
        }

    }
}
  1. Open index.html in your browser and you'll get this: iphone with HelloWorld app inside
  2. Click on your app and: HelloWorld app

iphone-css-mockup's People

Contributors

nulnow avatar thedarek497 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.