Permalink
Browse files

Navbar: Changed active state logic. Fixes #5707

Removed workaround for #1181. Fixed that issue by addressing the actual cause: event.target returns ui-btn-inner instead of the anchor
  • Loading branch information...
jaspermdegroot committed Apr 1, 2013
1 parent 5320abe commit 70e2aed27e09850a3488657d01a819ea07a167bf
Showing with 5 additions and 7 deletions.
  1. +5 −7 js/widgets/navbar.js
View
@@ -38,14 +38,12 @@ $.widget( "mobile.navbar", $.mobile.widget, {
});
$navbar.delegate( "a", "vclick", function( event ) {
if ( !$(event.target).hasClass( "ui-disabled" ) ) {
// ui-btn-inner is returned as target
var target = $( event.target ).is( "a" ) ? $( this ) : $( this ).parent( "a" );
if ( !target.is( ".ui-disabled, .ui-btn-active" ) ) {
$navbtns.removeClass( $.mobile.activeBtnClass );
$( this ).addClass( $.mobile.activeBtnClass );
// The code below is a workaround to fix #1181. We have to see why removeActiveLinkClass() doesn't take care of it.
var activeNavbtn = $( this );
$( document ).one( "pagechange", function( event ) {
activeNavbtn.removeClass( $.mobile.activeBtnClass );
});
target.addClass( $.mobile.activeBtnClass );
}
});

0 comments on commit 70e2aed

Please sign in to comment.