首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:jQuery Mobile 教程
TRY RUN / 在线示例
jQuery Mobile 教程 数据对象
jQuery Mobile 教程 数据对象
源代码
运行
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <script> $(document).on("pagebeforehide","#pagetwo",function(event,data){ alert(data.nextPage.attr("id") +" 将要展示"); }); $(document).on("pagebeforehide","#pagetwo",function(){ alert("页面二将被隐藏"); }) </script> </head> <body> <div data-role="page" id="pageone"> <div data-role="header"> <h1>头部文本</h1> </div> <div data-role="content"> <p>页面一</p> <a href="#pagetwo">跳转到页面二</a> </div> <div data-role="footer"> <h1>底部文本</h1> </div> </div> <div data-role="page" id="pagetwo"> <div data-role="header"> <h1>头部文本</h1> </div> <div data-role="content"> <p>页面二</p> <a href="#pageone">跳转到页面一</a> </div> <div data-role="footer"> <h1>底部文本</h1> </div> </div> </body> </html>
运行结果