4 function openMenu(anchor, menu, align) {
5 var anchorPosition = anchor.offset();
10 } else if (align == "right") {
11 offset = menu.outerWidth() - anchor.outerWidth();
17 top: anchorPosition.top + anchor.outerHeight(),
18 left: anchorPosition.left - offset
23 * Setup a menu, triggered by hovering over an anchor for a given time.
25 function createMenu(anchorid, menuid, align) {
26 var $anchor = $("#" + anchorid);
27 var $arrow = $("#" + anchorid + " .menuicon");
28 var $menu = $("#" + menuid);
29 var $page = $(":not(#" + menuid + ", #" + anchorid + ")");
33 $page.off("click", hide);
36 $arrow.click(function(e) {
37 if ($anchor.is(":not(.disabled)")) {
40 if ($menu.is(":visible")) {
42 $page.off("click", hide);
44 openMenu($anchor, $menu.show(), align);
45 $page.on("click", hide);