事件 = 所有不同訪(fǎng)問(wèn)者訪(fǎng)問(wèn)頁(yè)面的響應(yīng)動(dòng)作。

jQuery Mobile 事件 語(yǔ)法

在jQuery Mobile你可以使用任何標(biāo)準(zhǔn)的?jQuery 事件?。

除此之外, jQuery Mobile 也提供了針對(duì)移動(dòng)端瀏覽器的事件:

觸摸事件 - 當(dāng)用戶(hù)觸摸屏幕時(shí)觸發(fā)

滑動(dòng)事件 - 當(dāng)用戶(hù)上下滑動(dòng)時(shí)觸發(fā)

定位事件 - 當(dāng)設(shè)備水平或垂直翻轉(zhuǎn)時(shí)觸發(fā)

頁(yè)面事件 - 當(dāng)頁(yè)面顯示,隱藏,創(chuàng)建,加載或未加載時(shí)觸發(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>頁(yè)眉文本</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>如果您點(diǎn)擊我,我會(huì)消失。</p>
    <p>點(diǎn)擊我,我會(huì)消失。</p>
    <p>點(diǎn)擊我,我也會(huì)消失。</p>
  </div>

  <div data-role="footer">
    <h1>頁(yè)腳文本</h1>
  </div>
</div> 

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線(xiàn)實(shí)例