From 3cc5156a6d39528f1513328f3cd8651384be6073 Mon Sep 17 00:00:00 2001 From: jlabresh1 Date: Wed, 1 Feb 2012 09:51:55 -0600 Subject: [PATCH 1/2] added a copy of checkMenuHeight at a higher level so that it can be used on the top level menu. Also added 'true' to the jQuery.extend within the constructor so that the 'positionOpts' are not over written when just one or 2 properties are passed. --- fg.menu.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fg.menu.js b/fg.menu.js index d8d584f..8f039e4 100755 --- a/fg.menu.js +++ b/fg.menu.js @@ -38,7 +38,7 @@ function Menu(caller, options){ this.menuOpen = false; this.menuExists = false; - var options = jQuery.extend({ + var options = jQuery.extend(true,{ content: null, width: 180, // width of menu container, must be set or passed in to calculate widths of child menus maxHeight: 180, // max height of menu (if a drilldown: height does not include breadcrumb) @@ -76,6 +76,12 @@ function Menu(caller, options){ }); }; + + var checkMenuHeight = function(el){ + if (el.height() > options.maxHeight) { el.addClass('fg-menu-scroll') }; + el.css({ height: options.maxHeight }); + }; + this.kill = function(){ caller .removeClass(options.loadingState) @@ -235,7 +241,9 @@ function Menu(caller, options){ }, function(){ $(this).removeClass(options.linkHoverSecondary); } ); - }; + }; + + checkMenuHeight( container ); menu.setPosition(container, caller, options); menu.menuExists = true; From e983d7bb095c2f5c4bb7cd43527ed5b46e14ce37 Mon Sep 17 00:00:00 2001 From: jlabresh1 Date: Wed, 1 Feb 2012 10:47:21 -0600 Subject: [PATCH 2/2] added overwrite-able itemClickEvent --- fg.menu.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fg.menu.js b/fg.menu.js index 8f039e4..bb86a17 100755 --- a/fg.menu.js +++ b/fg.menu.js @@ -67,7 +67,11 @@ function Menu(caller, options){ flyOutOnState: 'ui-state-default', nextMenuLink: 'ui-icon-triangle-1-e', // class to style the link (specifically, a span within the link) used in the multi-level menu to show the next level topLinkText: 'All', - nextCrumbLink: 'ui-icon-carat-1-e' + nextCrumbLink: 'ui-icon-carat-1-e', + itemClickEvent: function( item ){ + $('#menuSelection').text($(item).text()); + location.href = $(item).attr('href'); + } }, options); var killAllMenus = function(){ @@ -212,7 +216,8 @@ function Menu(caller, options){ else { menu.drilldown(container, options); } } else { - container.find('a').click(function(){ + container.find('a').click(function( e ){ + e.preventDefault(); menu.chooseItem(this); return false; }); @@ -307,7 +312,8 @@ Menu.prototype.flyout = function(container, options) { ); }); - container.find('a').click(function(){ + container.find('a').click(function( e ){ + e.preventDefault(); menu.chooseItem(this); return false; });