Permalink
Browse files

[navbar] Move active state regain code out of _create() and into its …

…own prototype-level function and use ._on() to invoke it during "pagebeforeshow"
  • Loading branch information...
gabrielschulhof committed Aug 2, 2012
1 parent 9ea70df commit c0a016eb6768e5df802715f8f50b3c9b47749ec9
Showing with 9 additions and 3 deletions.
  1. +9 −3 js/widgets/navbar.js
View
@@ -44,10 +44,16 @@ $.widget( "mobile.navbar", $.mobile.widget, {
}
});
// Buttons in the navbar with ui-state-persist class should regain their active state before page show
$navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() {
$navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass );
$.extend( this, {
_navbtns: $navbtns
});
this._on( $navbar.closest( ".ui-page" ), { "pagebeforeshow": "_updateActiveClass" } );
},
_updateActiveClass: function() {
// Buttons in the navbar with ui-state-persist class should regain their active state before page show
this._navbtns.filter( ".ui-stat-persist" ).addClass( $.mobile.activeBtnClass );
}
});

0 comments on commit c0a016e

Please sign in to comment.