我正在使用移动应用程序,但我在手机上遇到了一些问题。我是begginer,但是当我阅读时,我只需插入这一行来使用phonegap的功能即可。Phonegap deviceready事件不会在设备上触发
<script src='phonegap.js'></script>
我不清楚deviceready事件是什么部分。我尝试用jquery,hammer和NO jquery mobile来构建应用程序。
我的问题是deviceready事件不会触发。我尝试了很多方法,如何绑定事件监听器,但我失败了。
我试图结合这样的:
document.addEventListener('deviceready', ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
这样的:
$(document).ready(function(){
document.addEventListener('deviceready', ondeviceready);
});
function ondeviceready(){
alert('wooohooo');
}
像这样:
$(document).on('deviceready',ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
有人可以帮助我吗?
(我测试在三星Galaxy S &三星Galaxy Note应用程序2)
只是为了澄清,这是因为你定义了使用它之后的函数,在这里你把函数定义放在document.addEventListener(...)调用的上面。 – jeprubio