的JavaScript。听听iPhone震动事件? [英] Javascript. Listen for iPhone shake event?
问题描述
是否可以使用JavaScript收听iPhone(或任何带加速度计的手机)震动事件?你知道就像摇动iPhone来改变iTunes中的下一首歌一样,当iPhone被震动时我想在我的网站上调用JS功能。
Is it possible to listen for an iPhone (or any mobile phone with accelerometer) shake event with JavaScript? You know like shaking the iPhone to shuffle the next song in iTunes I want to call a JS function on my website when the iPhone got shaken.
推荐答案
不是一个直接的网络应用程序,没有。如果您将Web应用程序包装在 PhoneGap 中,它会将加速计和其他仅限应用程序的功能公开给其中运行的站点,但缺点是人们必须真正下载你的应用程序 - 他们不能只浏览Safari中的网站。
Not as a straight web app, no. If you wrap your web app in PhoneGap, it exposes accelerometer and other app-only features to the site running within it, but the downside is that people have to actually download your app - they can't just browse to a site in Safari.
这篇关于的JavaScript。听听iPhone震动事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!