jQuery移动对话框在chrome中自动关闭
jQuery mobile dialog close automatically in chrome
我目前正在开发一个jQuery移动页面。我需要在对话框中显示一条错误消息,这在FF和IE中非常有效。但是当我用chrome打开页面时,对话框会自动关闭。
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<title>Header</title>
<meta name="viewport" id="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.mobile.changePage('#errorDialog', { transition: 'pop', role: 'dialog' });
});
</script>
</head>
<body>
<div data-role="page" data-theme="a">
<div data-role="header" data-position="fixed">
<h1>Home</h1>
</div>
<div data-role="footer" data-position="fixed">
<h4>Footer</h4>
</div>
</div>
<div id="errorDialog" data-role="dialog" data-close-btn="right" data-theme="a">
<div data-role="header">
<h1>Error</h1>
</div>
<div data-role="content">
<p>Error Message...</p>
</div>
</div>
</body>
</html>
我做错什么了吗?
这可能是您使用的jquerymobile版本的问题。尝试使用以下代码:
<link rel=stylesheet href=http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css />
<script src=http://code.jquery.com/jquery-1.6.min.js></script>
<script src=http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js>
</script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(function () {
$.mobile.changePage('#errorDialog', { transition: 'pop', role: 'dialog' });
}, 100);
});
</script>
</head>
<body>
<div data-role="page" data-theme="a">
<div data-role="header" data-position="fixed">
<h1>Home</h1>
</div>
<div data-role="footer" data-position="fixed">
<h4>Footer</h4>
</div>
</div>
<div id="errorDialog" data-role="dialog" data-close-btn="right" data-theme="a">
<div data-role="header">
<h1>Error</h1>
</div>
<div data-role="content">
<p>Error Message...</p>
</div>
</div>
</body>
</html>
相关文章:
- 如何将chrome扩展功能移植到移动设备(特别是jquery和trello)
- XMLHttpRequest在移动设备上的chrome上不起作用
- 移动Chrome和Safari之间的页面滚动不一致
- Chrome扩展:将下载的文件移动到输入字段
- jQuery:jQuery.val()在移动Safari和Chrome中不起作用
- 如何防止下拉刷新移动chrome
- 触摸事件因 Chrome 移动模拟器中的 ReactJS 升级而中断
- 砌体在移动浏览器(chrome)上不起作用,并且仅在Chrome桌面版本上有效,如果我重新加载(ctrl + f5)页面
- Chrome 扩展程序与移动设备之间通过本地网络进行安全通信
- 移动版 Chrome 上的 IFrame 播放器 API
- 如何在chrome浏览器中的输入字段中使用只读属性时启用光标移动
- Chrome 会在我移动窗口时隐藏我的窗口
- Chrome.extension API 在移动版 Chrome 上是否可用
- 将其混合在选项卡1中不起作用,但在另一个选项卡中起作用,即chrome和移动设备中的选项卡2
- jQuery移动对话框在chrome中自动关闭
- jQuery-如何在Chrome中调整鼠标移动图像的大小
- HTML5通知与服务工作者在Chrome移动不工作
- 不同的陀螺仪值在chrome移动和safari移动
- 音频- Chrome移动-安卓
- Carousel不是用chrome移动图像