Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions fg.menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(){
Expand All @@ -76,6 +80,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)
Expand Down Expand Up @@ -206,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;
});
Expand Down Expand Up @@ -235,7 +246,9 @@ function Menu(caller, options){
},
function(){ $(this).removeClass(options.linkHoverSecondary); }
);
};
};

checkMenuHeight( container );

menu.setPosition(container, caller, options);
menu.menuExists = true;
Expand Down Expand Up @@ -299,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;
});
Expand Down