Latest web development tutorials

Acara jQuery Mobile pageshow

jQuery Mobile Acara jQuery Mobile Acara

contoh

Setelah halaman ditampilkan setelah beralih pesan pop-up:

$(document).on("pageshow","#pagetwo",function(){
alert("pageshow 事件触发 - 展示页面二");
});

Coba »

Definisi dan Penggunaan

Acara pageshow setelah halaman ditampilkan setelah saklar pemicu.

peristiwa terkait:

  • pagebeforeshow - sebelum menampilkan halaman setelah peristiwa saklar pemicu.
  • pagebeforehide - sebelum beralih halaman lama setelah halaman tersembunyi peristiwa pemicu.
  • pagehide - setelah halaman demi halaman beralih tua peristiwa pemicu tersembunyi.

Catatan: Acara ini dipicu ketika sebuah halaman transisi awal / akhir.


tatabahasa

peristiwa pemicu di semua halaman di jQuery Mobile:

$("document").on("pageshow",function(event){...}) 尝试一下

Memicu halaman acara tertentu:

$("document").on("pageshow"," page ",function(event,data){...}) 尝试一下

参数 描述
function(event,data) 必须。指定 pageshow 事件触发时执行的函数。

该函数含有以下两个参数:

  • 事件对象 - 包括任何jQuery事件属性 ( event.target, event.type 等) 。更多信息请查阅 jQuery 事件参考手册
  • 数据对象 - 包含属性 nextPage, 要返回的过渡页面。
page 可选。 指定 pagebeforehide 事件触发时指向的页面id。 内部页面, 请使用 #id 。外部页面,请使用 externalfile.html


contoh

contoh yang lebih

peristiwa terkait menunjukkan.
Contoh ini menunjukkan pagebeforeshow, pageshow, pagebeforehide pagehide dan memicu peristiwa.

benda acara
Gunakan event.type vertikal pulang memicu jenis acara.

Data Objects
Menggunakan properti prevPage untuk kembali ke halaman sebelumnya.


jQuery Mobile Acara jQuery Mobile Acara