Browse files

Merge pull request #8 from Hambrook/master

Added support for not processing a menu
  • Loading branch information...
2 parents 1d6aa47 + 64aa12f commit c4ee7a12f6af81b9698c5ce6aeb96f02bc3fdd7a @sebnitu committed Sep 4, 2012
Showing with 23 additions and 16 deletions.
  1. +23 −16 jquery.horizontalNav.js
View
39 jquery.horizontalNav.js
@@ -29,28 +29,18 @@
var ul_wrap = $this;
}
- if ($('.clearHorizontalNav').length ) {
- ul_wrap.css({ 'zoom' : '1' });
- } else {
- ul_wrap.css({ 'zoom' : '1' }).append('<div class="clearHorizontalNav">');
- // let's append a clearfixing element to the ul wrapper
- $('.clearHorizontalNav').css({
- 'display' : 'block',
- 'overflow' : 'hidden',
- 'visibility' : 'hidden',
- 'width' : 0,
- 'height' : 0,
- 'clear' : 'both'
- });
- }
-
// Grab elements we'll need and add some default styles
var ul = $this.is('ul') ? $this : ul_wrap.find('> ul'), // The unordered list element
li = ul.find('> li'), // All list items
li_last = li.last(), // Last list item
li_count = li.size(), // The number of navigation elements
li_a = li.find('> a'); // Remove padding from the links
+ if (o.minimumItems && o.minimumItems > li_count) {
+ $this.addClass("horizontalNav-notprocessed");
+ return false;
+ }
+
// If set to responsive, re-construct after every browser resize
if ( o.responsive === true ) {
// Only need to do this for IE7 and below
@@ -60,6 +50,21 @@
}
}
+ if ($('.clearHorizontalNav').length ) {
+ ul_wrap.css({ 'zoom' : '1' });
+ } else {
+ ul_wrap.css({ 'zoom' : '1' }).append('<div class="clearHorizontalNav">');
+ // let's append a clearfixing element to the ul wrapper
+ $('.clearHorizontalNav').css({
+ 'display' : 'block',
+ 'overflow' : 'hidden',
+ 'visibility' : 'hidden',
+ 'width' : 0,
+ 'height' : 0,
+ 'clear' : 'both'
+ });
+ }
+
// Initiate the plugin
_construct();
@@ -130,6 +135,7 @@
ul.css({ 'display' : 'table', 'float' : 'none', 'width' : '100%' });
li.css({ 'display' : 'table-cell', 'float' : 'none' });
}
+ $this.addClass("horizontalNav-processed").removeClass("horizontalNav-notprocessed");
}
}); // @end of return this.each()
@@ -139,7 +145,8 @@
$.fn.horizontalNav.defaults = {
responsive : true,
responsiveDelay : 100,
- tableDisplay : true
+ tableDisplay : true,
+ minimumItems : 0
};
})(jQuery);

0 comments on commit c4ee7a1

Please sign in to comment.