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