Archives
-
Active button in navbar in Jquery Mobile
When you add ui-btn-active class to your anchor, it will activate the selected button in your navbar. Moreover, if you'd like to keep it active when you return to it again, you need to add ui-state-persist.
jquery mobile framework detects ui-state-persist class, then fires the delegate as following:
$navbar.delegate( "a", "vclick", function( event ) { if( !$(event.target).hasClass("ui-disabled") ) { $navbtns.not(".ui-state-persist" ).removeClass( $.mobile.activeBtnClass ); $( this ).addClass( $.mobile.activeBtnClass ); } });