user976746
user976746

Reputation: 333

Jquery Mobile & Cordova Event Pageinit Binding Wont Work

im Going mad after this... i followed a lot of pages even here in stack overflow but i cant make it to work

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');
        });    
    });  

    });

    });

but this wont work in any way, any suggestion? thanks

Upvotes: 1

Views: 569

Answers (1)

Aaron
Aaron

Reputation: 1072

I believe you may be binding to the wrong method. Instead of binding to the pagebeforeload, try binding to the pagebeforeshow event. pagebeforeload is fired when the framework is going to load an external page. I'm just guessing here, since you haven't given more details on what #login is (I'm assuming it's a div with a data-role="page" attribute.

Upvotes: 1

Related Questions