Skip to content

Commit

Permalink
Menu: Further refactoring of next/previousPage
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Oct 28, 2010
1 parent c55977d commit 8959057
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions ui/jquery.ui.menu.js
Expand Up @@ -192,18 +192,14 @@ $.widget("ui.menu", {
height = this.element.height(), height = this.element.height(),
result; result;
this.active.nextAll( ".ui-menu-item" ).each( function() { this.active.nextAll( ".ui-menu-item" ).each( function() {
var close = $( this ).offset().top - base - height; result = $( this );
if (close >= 0) { return $( this ).offset().top - base - height < 0;
result = $( this );
return false;
}
}); });


this.activate( event, result || this.element.children( ".ui-menu-item" ).last() ); this.activate( event, result );
} else { } else {
this.activate( event, this.element.children( ".ui-menu-item" ) this.activate( event, this.element.children( ".ui-menu-item" )
// TODO use .first()/.last() [ !this.active || this.last() ? "first" : "last" ]() );
.filter( !this.active || this.last() ? ":first" : ":last" ) );
} }
}, },


Expand All @@ -219,18 +215,14 @@ $.widget("ui.menu", {
height = this.element.height(), height = this.element.height(),
result; result;
this.active.prevAll( ".ui-menu-item" ).each( function() { this.active.prevAll( ".ui-menu-item" ).each( function() {
var close = $(this).offset().top - base + height; result = $( this );
if (close <= 0) { return $(this).offset().top - base + height > 0;
result = $( this );
return false;
}
}); });


this.activate( event, result || this.element.children( ".ui-menu-item" ).first() ); this.activate( event, result );
} else { } else {
this.activate( event, this.element.children( ".ui-menu-item" ) this.activate( event, this.element.children( ".ui-menu-item" )
// TODO use .first()/.last() [ !this.active || this.first() ? ":last" : ":first" ]() );
.filter( !this.active || this.first() ? ":last" : ":first" ) );
} }
}, },


Expand Down

0 comments on commit 8959057

Please sign in to comment.