zoukankan      html  css  js  c++  java
  • jQuery Mobile_页面事件

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
    <script>
    $(document).on("pagebeforecreate","#home",function(){
        alert("pagebeforecreate");
    });
    $(document).on("pagecreate","#home",function(){
        alert("pagecreate");
    });
    $(document).on("pageinit","#home",function(){
        alert("pageinit");
    });
    $(document).on("pageload",function(event,data){
        alert("触发pageload事件 URL:"+data.url);
    });
    $(document).on("pageloadfailed",function(event,data){
        alert("触发pageloadfailed事件,页面不存在");
    });
    $(document).on("pagebeforeshow","#page1",function(){
        alert("触发pagebeforeshow事件,page1页面即将显示。 事件是针对page1页面的事件");
    });
    $(document).on("pageshow","#page1",function(){
        alert("触发pageshow事件,现在显示page1页面。 事件是针对page1页面的事件");
    });
    $(document).on("pagebeforehide","#page1",function(){
        alert("触发pagebeforehide事件,page1页面即将隐藏。 事件是针对page1页面的事件");
    });
    $(document).on("pagehide","#page1",function(){
        alert("触发pagehide事件,page1隐藏。 事件是针对page1页面的事件");
    });
    </script>
    </head>

    <body>
    <div data-role="page" id="home">
        <div data-role="header">header</div>
        <div data-role="content">
            <a href="data-icon.html">存在data-icon.html</a>
            <a href="data-icon2.html">不存在data-icon2.html</a><br/>
            <p >页面home</p>
            <a href="#page1" >跳到page1</a>
        </div>
        <div data-role="footer" data-theme="d">footer</div>
    </div>
    <div data-role="page" id="page1">
        <div data-role="header" >page1</div>
        <div data-role="content">
            <p>page1</p><br>
            <a href="#home">跳到home</a>
        </div>
        <div data-role="footer" >footer</div>
    </div>
    </body>
    </html>
    后来都会美好的!
  • 相关阅读:
    Java面试——从JVM角度比较equals和==的区别
    Java线程和多线程(三)——线程安全和同步
    玩转Android之MVVM开发模式实战,炫酷的DataBinding!
    写点什么好呢2? 钱、事业、婚姻、人生意义
    写点什么好呢2? 钱、事业、婚姻、人生意义
    大型网站架构技术一览
    【树莓派】GSM900模块
    【Latex】数学公式排版
    【MYSQL】导入中文后乱码问题
    【R】shiny界面
  • 原文地址:https://www.cnblogs.com/momox/p/5090648.html
Copyright © 2011-2022 走看看