我在这之后会发疯...即使在堆栈溢出的情况下,我也跟踪了很多页面,但我无法使其正常工作
Bootstrap.js
var jqmReady = $.Deferred(),
pgReady = $.Deferred();
// jqm page is ready
$(document).bind("pageinit", jqmReady.resolve);
// phonegap ready
document.addEventListener("deviceready", pgReady.resolve, false);
// all ready, throw a custom 'PG_pageinit' event
$.when(jqmReady, pgReady).then(function () {
$(document).trigger("xpageinit");
});
Index.html
$(document).bind("xpageinit", function(){
//Login Page
$('#login').live( 'pagebeforeload',function(event){
$('a').buttonMarkup({ inline: true });
$("#logo").fadeIn('slow', function(){
$(this).animate({'top': '-=80px'},'slow', function(){
$(".formLogin").fadeIn('slow');
});
});
});
});
但这不会以任何方式起作用,有什么建议吗?
谢谢
最佳答案
我相信您可能绑定了错误的方法。尝试绑定到pagebeforeshow事件,而不是绑定到pagebeforeload。当框架要加载外部页面时,将触发pagebeforeload。我只是在这里猜测,因为您没有提供有关#login的更多详细信息(我假设它是具有data-role =“ page”属性的div。
关于javascript - jQuery Mobile和Cordova事件Pageinit绑定(bind)无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13505305/