more menu
This commit is contained in:
parent
5473d0502c
commit
ed5667de85
1 changed files with 58 additions and 35 deletions
|
@ -1763,6 +1763,7 @@ requires
|
|||
" Ox" + Ox.toTitleCase(self.options.size)
|
||||
),
|
||||
itemHeight = self.options.size == "small" ? 12 : (self.options.size == "medium" ? 16 : 20),
|
||||
menuHeight,
|
||||
scrollSpeed = 1, // fixme: should this be self.scrollSpeed?
|
||||
$item; // fixme: used?
|
||||
|
||||
|
@ -1937,11 +1938,27 @@ requires
|
|||
});
|
||||
}
|
||||
|
||||
function scrollMenuUp() {
|
||||
if (that.$scrollbars.up.is(":visible")) {
|
||||
that.$content.css({
|
||||
top: "0px"
|
||||
});
|
||||
that.$scrollbars.up.hide();
|
||||
if (that.$scrollbars.down.is(":hidden")) {
|
||||
that.$scrollbars.down.show();
|
||||
} else {
|
||||
that.$container.height(that.$container.height() + itemHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function selectNextItem() {
|
||||
var offset,
|
||||
selected = self.options.selected;
|
||||
if (!isLastEnabledItem()) {
|
||||
if (selected > -1) {
|
||||
if (selected == -1) {
|
||||
scrollMenuUp();
|
||||
} else {
|
||||
that.items[selected].trigger("mouseleave");
|
||||
}
|
||||
do {
|
||||
|
@ -1971,6 +1988,7 @@ requires
|
|||
function selectPreviousItem() {
|
||||
var offset,
|
||||
selected = self.options.selected;
|
||||
if (selected > - 1) {
|
||||
if (!isFirstEnabledItem()) {
|
||||
that.items[selected].trigger("mouseleave");
|
||||
do {
|
||||
|
@ -1994,8 +2012,10 @@ requires
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function selectSubmenu() {
|
||||
if (self.options.selected > -1) {
|
||||
var submenu = that.submenus[that.items[self.options.selected].options("id")];
|
||||
if (submenu && submenu.hasEnabledItems()) {
|
||||
that.loseFocus();
|
||||
|
@ -2003,6 +2023,7 @@ requires
|
|||
submenu.selectFirstItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function selectSupermenu() {
|
||||
if (self.options.parent) {
|
||||
|
@ -2034,13 +2055,7 @@ requires
|
|||
return false;
|
||||
}
|
||||
});
|
||||
if (that.$scrollbars.up.is(":visible")) {
|
||||
that.$content.css({
|
||||
top: "0px"
|
||||
});
|
||||
that.$scrollbars.up.hide();
|
||||
that.$container.height(that.$container.height() + itemHeight);
|
||||
}
|
||||
scrollMenuUp();
|
||||
that.hide();
|
||||
if (self.options.selected > -1) {
|
||||
that.items[self.options.selected].trigger("mouseleave");
|
||||
|
@ -2061,6 +2076,7 @@ requires
|
|||
};
|
||||
|
||||
that.selectFirstItem = function() {
|
||||
Ox.print("selectFirstItem")
|
||||
selectNextItem();
|
||||
};
|
||||
|
||||
|
@ -2072,15 +2088,22 @@ requires
|
|||
height = self.options.element.outerHeight(),
|
||||
left = offset.left + self.options.offset.left + (self.options.side == "bottom" ? 0 : width),
|
||||
top = offset.top + self.options.offset.top + (self.options.side == "bottom" ? height : 0),
|
||||
menuHeight = that.outerHeight(),
|
||||
maxHeight = Math.floor($window.height() - top - 16);
|
||||
Ox.print("height", height, "maxHeight", maxHeight);
|
||||
menuHeight = menuHeight || that.outerHeight();
|
||||
Ox.print("menuHeight", menuHeight, "maxHeight", maxHeight);
|
||||
if (self.options.parent) {
|
||||
if (menuHeight > maxHeight) {
|
||||
top = Ox.limit(top - menuHeight + maxHeight, self.options.parent.offset().top, top);
|
||||
maxHeight = Math.floor($window.height() - top - 16);
|
||||
}
|
||||
}
|
||||
that.css({
|
||||
left: left + "px",
|
||||
top: top + "px"
|
||||
}).show();
|
||||
if (menuHeight > maxHeight) {
|
||||
that.$container.height(maxHeight - itemHeight);
|
||||
Ox.print(maxHeight - itemHeight);
|
||||
that.$container.height(maxHeight - itemHeight - 8); // margin
|
||||
that.$scrollbars.down.show();
|
||||
}
|
||||
if (!self.options.parent) {
|
||||
|
|
Loading…
Reference in a new issue