你能告诉我为什么 pageshow 事件在 jquery mobile 中没有调用吗? http://jsfiddle.net/G7AvE/
$(document).ready(function(){
$("#1").on('pagebeforeshow ', function() {
//YourFunctionCall();
alert('1')
});
});
jQuery( "#1" ).on( "pageshow", function( event ) { alert('1') } )
最佳答案
不要在 jQuery Mobile 中使用 .ready()
,而是使用 pageinit
。此外,对于页面 id,不要使用纯数字; id
应包含字符。
$(document).on("pageinit", "#pageID", function () {
$("#pageID").on('pagebeforeshow ', function () {
/* run code */
});
});
关于javascript - 为什么pageshow不能在jquery mobile中调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22917751/