页面创建phonegap jquery mobile
page create phonegap jquery mobile
我试图在加载页面时执行脚本,但它不起作用
首先,我用加载我的第一页
$('#loadingPage').bind('pageinit', function(event) {...}
这很管用我将页面重定向到menu.html
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<div date-role="page" id="menuPage"></page>
</body>
</html>
在我的脚本文件中,我有
$('#menuPage').live('pageshow', function(event) {alert('bbb')};
$('#menuPage').live('click', function(event) {alert('aaa')};
我从来没有警报bbb,但当我点击屏幕时,我有警报aaa
完整的脚本代码:
http://pastebin.com/Jh676yFZ
感谢
您的代码中有两个问题。Pagecreate不应用作页面加载触发器,最好使用pagebeforechange和pageshow。这是第一个问题。第二个是menu.html页面格式中的错误,现在也已修复。
还有一件事,这不是错误,但我已经更改了事件绑定的live(with on)函数。目前这不是问题,但live目前已被弃用,我认为它在jQuery 1.9 中无法再工作了
相关文章:
- 无法从jquery Mobile导航栏重定向到另一个页面
- jquery mobile上多个页面上的一个表单
- window.location使用jquery mobile实现chrome跳转
- 防止jQuery Mobile中的ajax缓存
- 如何在JQUERY Mobile上放置谷歌地图
- JQuery Mobile Javascript复杂方程式
- jQuery Mobile Undefined不是一个函数
- jQuery mobile not going through ID
- 如何使用javascript或jquery mobile从url读取和显示XML文件
- jQuery Mobile Collapse上的AJAX请求
- 应用程序在呈现Jquery Mobile之前显示无样式的Html
- 如何在jQuery Mobile 1.4 Datepicker中创建事件
- UIWebview赢得't通过基本身份验证加载动态加载的资源(通过jQuery mobile)
- jQuery Mobile到其他页面的锚链接不起作用
- 如何在jQuery Mobile中设置100%宽度的输入类型日期
- JQuery Mobile破坏了我的布局:如何禁用自动打字
- 防止用户在jQuery Mobile中ajax加载页面时单击其他位置
- 根据手机上是否存在文件,在jQuery mobile中动态填充列表视图
- Image Sprites和jQuery Mobile Ajax导航的问题
- jQuery Mobile:如何在$.Mobile.changePage之前运行回调函数