-1

I was wondering of there is a way to trigger the shake event within a mobile web app?

--EDIT--- Without using Phonegap.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Steaphann
  • 3,431
  • 3
  • 18
  • 15

2 Answers2

1

You didn't google much did you? :)

Phonegap - Handling Shake Events

edit: Read this Stackoverflow Article. Dont get distracted by the "Phonegap" in the title - it works without it. As a summary: You can invoke Java Code with Javascript and would invoke the native Accelerometer from your web code. Invoking Java Code with Javascript

Community
  • 1
  • 1
最白目
  • 3,505
  • 6
  • 59
  • 114
0

Shake.js is a custom 'shake' event JavaScript plugin for mobile web browsers using device accelerometer. Your web browser must support the devicemotion event for this plugin to work. Shake.js uses built-in feature detection to determine if it can run in your web browser. It will terminate silently on non-supporting browsers.

You might want to check this out: http://functionn.blogspot.com/2012/03/shakejs-custom-shake-event-javascript.html

Hirvesh
  • 7,636
  • 15
  • 59
  • 72