Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit c0a016eb6768e5df802715f8f50b3c9b47749ec9 1 parent 9ea70df
Gabriel "_|Nix|_" Schulhof gabrielschulhof authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 js/widgets/navbar.js
12 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 );
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.