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 $arrow = $("#" + anchorid + ' .arrow'),
28 $menu = $("#" + menuid),
29 $page = $(':not(#' + menuid + ', #' + anchorid + ')');
33 $page.unbind('click', hide);
36 $arrow.click(function(e) {
39 if ($menu.is(':visible')) {
41 $page.unbind('click', hide);
43 openMenu($anchor, $menu.show(), 'left');
44 $page.bind('click', hide);