Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Navbar: Changed active state logic. Fixes #5707
Browse files Browse the repository at this point in the history
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 70e2aed
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions js/widgets/navbar.js
Expand Up @@ -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 );
}
});

Expand Down

0 comments on commit 70e2aed

Please sign in to comment.