0

I'm building a small game using jquery and javascript.

It's a game for catching the fruits falling into the basket. The basket should move left or right on turning the phone left or right.

Since I am new to Javascript I don't know exactly which event listener must be called to check for the same.

Please let me know how can we move the basket left or right based on turning screen from left to right.

Hardik Kalathiya
  • 2,221
  • 1
  • 18
  • 28
Rohit Mishra
  • 281
  • 5
  • 16

1 Answers1

0

The event for trapping device motion is ondeviceorientation. There is another question here on SO with a more detailed explanation of the event and its compatibility.

How to access accelerometer / gyroscope data from javascript

Community
  • 1
  • 1
allnodcoms
  • 1,244
  • 10
  • 14