Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ If this is true, we'll move the list items back to where they were before, and r
(boolean, defaults to 'true')
Should we absolutely position the popup? Usually this is a good idea. That way, the popup can appear over other content and spill outside a parent that has overflow: hidden set. If you want to do something different from this in CSS, just set this option to false.

###popupClass
(string, defaults to '')
If this is set, this class will be added to the popup

##License

flexMenu is licensesed under the MIT License, and is free for commercial or personal use.
Expand Down
5 changes: 4 additions & 1 deletion flexmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'linkTitleAll' : 'Open/Close Menu', // [string] If we hit the cutoff, what should the title of the "view more" button be?
'showOnHover' : true, // [boolean] Should we we show the menu on hover? If not, we'll require a click. If we're on a touch device - or if Modernizr is not available - we'll ignore this setting and only show the menu on click. The reason for this is that touch devices emulate hover events in unpredictable ways, causing some taps to do nothing.
'popupAbsolute' : true, // [boolean] Should we absolutely position the popup? Usually this is a good idea. That way, the popup can appear over other content and spill outside a parent that has overflow: hidden set. If you want to do something different from this in CSS, just set this option to false.
'popupClass' : '', // [string] If this is set, this class will be added to the popup
'undo' : false // [boolean] Move the list items back to where they were before, and remove the "View More" link.
}, options);
this.options = s; // Set options on object
Expand Down Expand Up @@ -81,7 +82,9 @@
var $popup = $('<ul class="flexMenu-popup" style="display:none;' + ((s.popupAbsolute) ? ' position: absolute;' : '') + '"></ul>'),
// Move all list items after the first to this new popup ul
firstItemOffset = $firstItem.offset().top;
for (i = numItems; i > 1; i--) {
// Add class if popupClass option is set
$popup.addClass(s.popupClass);
for (i = numItems; i > 1; i--) {
// Find all of the list items that have been pushed below the first item. Put those items into the popup menu. Put one additional item into the popup menu to cover situations where the last item is shorter than the "more" text.
$lastChild = $this.find('> li:last-child');
keepLooking = (needsMenu($lastChild));
Expand Down