Pagebeforecreate fires twice?
I´m hooking up my buttons with this code:
- $( '#startpage' ).live( 'pagebeforecreate',function()
- {
- console.log('pagebeforecreate started');
- console.log('hook btns');
-
- $("#info").on('tap',function()
- {
- $.mobile.changePage('pages/info/info.html');
- return false;
-
- });
Problem is that is seems to fire twice and that is a problem (since i "hook" up the buttons).
I also have this on the page and i think that the $.mobile.ChangePage will make the event fire off twice for some reason:
- $( '#startpage' ).live( 'pageshow',function(event,ui)
{
- $.ajaxSetup({timeout:20000});
setVar("set_somevar",10,true);
if (isLogedIn)
{
$('#startcontent').show();
$('#startpageheader').show();
}
else
{
$.mobile.changePage('pages/login/login.html',{ changeHash: false});
}
});
How can i make the script to only "hook" buttons once? Why does the pagebeforecreate fire off twice?