0
当我尝试打开一个对话框时,它从它打开的页面重新加载JavaScript文件。 页面不刷新,它只是JavaScript。jQuery Mobile对话框从它被打开的页面重新加载JavaScript从
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="css/frameworks/jquery.mobile-1.3.0.css">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery.mobile-1.3.0.js"></script>
<script src="js/test.js"></script>
</head>
<body>
<div id="page" data-role="page">
<a href="dialog.html" data-rel="dialog" transition="pop" data-role="button" data-icon="check" data-inline="true">Open Dialog</a>
</div>
</body>
</html>
dialog.html只是默认页面,test.js包含:
$(document).bind('pageinit', function() {
alert("fire");
}
如何预防呢?
我实现你的代码,但结果是一样的:显示test.js的警报打开对话框时。 难道它不得不用$ .mobile.ajaxEnabled做些什么吗? – joekeee 2013-04-26 11:31:03
@joekeee它应该被启用,因为它通过Ajax加载对话框。 – Omar 2013-04-26 12:11:25