在 jQuery Mobile 中,当进行输入并单击“下一步”按钮时,我有几个链接的对话框一个接一个地滑入/滑出。但是,每当单击对话框标题内的关闭按钮时,我都想返回到触发第一个对话框的初始页面。通常,每个对话框中的关闭按钮都会返回到触发它的页面/框。但在我的应用程序中,我需要覆盖所有这些才能返回第一页!
我的代码:
<div class="ui-block-b">
<a data-role="button" data-theme="b" data-icon="arrow-r" data-iconpos="right"
data-transition="slide" href="nextpage.html" data-rel="dialog">
next
</a>
</div>
谢谢!
编辑:文档说
CHAINING DIALOGS: "Please note: If a dialog opens another dialog (chaining), closing the last one with a link of type data-rel="back" will always navigate to the previous dialog until the root-page of type data-role="page" is reached. This guarantees a consistent navigation between dialogs." [http://jquerymobile.com/demos/1.2.0-beta.1/docs/pages/page-dialogs.html]
最佳答案
您可以重写为对话框定义的 close 方法$.mobile.dialog.prototype.close
:
<script>
$.mobile.dialog.prototype.close = function(){
console.log("close");
// DO SOMETHING HERE - EX: REDIRECTING TO MAIN PAGE
$.mobile.changePage("index.html");
};
$(function() {
console.log("document loaded");
});
</script>
关于javascript - 如何覆盖 jquery mobile 中链接对话框中关闭按钮的功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12823870/