Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying PhoneGap Beginners Guide (third edition)
  • Table Of Contents Toc
  • Feedback & Rating feedback
PhoneGap Beginners Guide (third edition)

PhoneGap Beginners Guide (third edition)

By : Ramanujam, Giorgio Natili
3.7 (6)
close
close
PhoneGap Beginners Guide (third edition)

PhoneGap Beginners Guide (third edition)

3.7 (6)
By: Ramanujam, Giorgio Natili

Overview of this book

This book is for web developers who want to be productive in the mobile market quickly. In fact, by using PhoneGap, it's possible to deploy native applications based on web standards. This book assumes a very small knowledge of HTML/CSS/JavaScript and mobile platforms, such as Android, BlackBerry, iOS, and Windows Phone, and takes the reader step-by-step into a deep overview of PhoneGap and its APIs.
Table of Contents (16 chapters)
close
close
13
C. Related Plugin Resources
15
Index

Time for action – handling device orientation with JavaScript


Execute the following steps:

  1. Open the command-line tool and create a new PhoneGap project named orientationevents, and add the platforms you want to target for this example.

  2. Install the plugin to your project:

    $ phonegap plugin add cordova-plugin-device-motion
    
  3. Go to the www folder, open the index.html file, and add div with the #orientation ID inside the main div of the app beneath #deviceready:

    <div class="app">
        <h1>Apache Cordova</h1>
        <div id="deviceready">
            ......
        </div>
        <div id="orientation">
        </div>
    </div>
  4. Go to the css folder and define two new rules inside the index.css file to give a border and a bigger font size to div and its content. You can even add the CSS styles directly to the head section of your HTML page:

    #orientation{
    
        width: 230px;
        border: 1px solid rgb(10, 1, 1);
    
    }
    
    #orientation p{
        font-size: 36px;
        font-weight: bold;
       ...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
PhoneGap Beginners Guide (third edition)
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon