事件 = 所有不同訪問者訪問頁面的響應動作。

jQuery Mobile 事件 語法

在jQuery Mobile你可以使用任何標準的?jQuery 事件?。

除此之外, jQuery Mobile 也提供了針對移動端瀏覽器的事件:

觸摸事件 - 當用戶觸摸屏幕時觸發(fā)

滑動事件 - 當用戶上下滑動時觸發(fā)

定位事件 - 當設備水平或垂直翻轉時觸發(fā)

頁面事件 - 當頁面顯示,隱藏,創(chuàng)建,加載或未加載時觸發(fā)

jQuery Mobile 事件 示例

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).on("pagecreate","#pageone",function(){
  $("p").on("click",function(){
    $(this).hide();
  });                       
});
</script>
</head>
<body>

<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>頁眉文本</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>如果您點擊我,我會消失。</p>
    <p>點擊我,我會消失。</p>
    <p>點擊我,我也會消失。</p>
  </div>

  <div data-role="footer">
    <h1>頁腳文本</h1>
  </div>
</div> 

</body>
</html>

運行實例 ?

點擊 "運行實例" 按鈕查看在線實例