-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
PhoneGap Beginners Guide (third edition)
By :
Refer to the following steps to implement multitouch gestures in your app using the Hammer JavaScript library:
Open the command-line tool and create a new PhoneGap project called hammer:
$ cordova create hammer
Using the command-line tool, add the platform you want to use for this test (Android, Blackberry, iOS, or Windows Phone 8):
$ cordova platform add android
Download the Hammer-related files from https://github.com/hammerjs/hammer.js and save it in the www/js folder. You can find both hammer.min.js and hammer.js files in the download bundle from GitHub. You can just keep the hammer.min.js file and delete the rest.
Include the hammer.min.js file in your index.html file to start using Hammer:
<script src=”js/hammer.min.js”></script>
Add a div element named touch to the page body. This element will be attached to all the touch events we are going to create:
<div id=”touch”>Try Me</div>
Now, let's create the event listeners...
Change the font size
Change margin width
Change background colour