mozbrowseractivitydone
mozbrowserasyncscroll
mozbrowseraudioplaybackchange
mozbrowsercaretstatechanged
mozbrowserclose
mozbrowsercontextmenu
mozbrowserdocumentfirstpaint
mozbrowsererror
mozbrowserfindchange
mozbrowserfirstpaint
mozbrowsericonchange
mozbrowserloadend
mozbrowserloadstart
mozbrowserlocationchange
mozbrowsermanifestchange
mozbrowsermetachange
mozbrowseropensearch
mozbrowseropentab
mozbrowseropenwindow
mozbrowserresize
mozbrowserscroll
mozbrowserscrollareachanged
mozbrowserscrollviewchange
mozbrowsersecuritychange
mozbrowserselectionstatechanged
mozbrowsershowmodalprompt
mozbrowsertitlechange
mozbrowserusernameandpasswordrequired
mozbrowservisibilitychange
DOMContentLoaded
abort
afterprint
afterscriptexecute
beforeprint
beforescriptexecute
beforeunload
blur
cancel
canplay
canplaythrough
change
click
close
connect
contextmenu
durationchange
emptied
error
focus
hashchange
input
invalid
languagechange
load
loadeddata
loadedmetadata
loadend
loadstart
message
offline
online
open
pagehide
pageshow
play
playing
popstate
progress
readystatechange
rejectionhandled
reset
seeked
seeking
select
show
sort
stalled
storage
submit
suspend
timeupdate
toggle
unhandledrejection
unload
volumechange
waiting
DeviceOrientationEvent
was implemented. You should use that API instead.An event that is repeatedly fired on the window as accelerator data is provided to the browser.
The X axis represents the amount of right-to-left tilt. This value is 0 if the device is level along the X axis, and approaches 1 as the device is tilted toward the left, and -1 as the device is tilted toward the right.
The Y axis represents the amount of front-to-back tilt. The value is 0 if the device is level along the Y axis, and approaches 1 as you tilt the device backward (away from you) and -1 as you tilt the device frontward (toward you).
The Z axis represents acceleration vertically. The value is -1
when the device is undergoing standard Earth gravity (9.8m/sec2) but not moving. Moving the device upward causes the value to increase. The value is 0
if the device is being thrust upward. In free fall (weightless or falling as a result of a drop), the value remains -1
.
In weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated.
In Firefox versions 3.6, 4, and 5 Gecko utilized MozOrientation
which was also built to support orientation data but with different APIs from the specified DeviceOrientationEvent
.
To normalize between the two you can do something like this:
function orientationhandler(evt){ // For FF3.6+ if (!evt.gamma && !evt.beta) { evt.gamma = -(evt.x * (180 / Math.PI)); evt.beta = -(evt.y * (180 / Math.PI)); } // use evt.gamma, evt.beta, and evt.alpha // according to dev.w3.org/geo/api/spec-source-orientation } window.addEventListener('deviceorientation', orientationhandler, false); window.addEventListener('MozOrientation', orientationhandler, false);
window.addEventListener("MozOrientation", doFunc, true);
The example below simply displays the raw accelerometer data in the browser window as the events arrive.
This event is only dispatched if an accelerometer is available on the current device.
Not part of any specification.