Return to Snippet

Revision: 53052
at November 11, 2011 03:48 by parkerkrhoyt


Initial Code
var watchId = 0;

watchId = navigator.compass.watchHeading( function( heading ) {
  $( '#compass' ).css( '-webkit-transform', 'rotate( ' + heading.magneticHeading + 'deg )' );
}, function( error ) {
  console.log( 'Error' );
}, {
  frequency: 100
} );

Initial URL


Initial Description


Initial Title
Using the Device Compass with PhoneGap

Initial Tags
phone, mobile

Initial Language
JavaScript