1/*! 2 * 3 * Hover Dropdown And Megamenu 4 * http://www.zozothemes.com/ 5 * 6 */ 7(function($) { 8 9 // init ondomready 10 $(function() { 11 12 // init all menus 13 $('ul.navbar-nav').each(function() { 14 var $this = $(this); 15 $this.addClass('sm').smartmenus({ 16 17 // these are some good default options that should work for all 18 // you can, of course, tweak these as you like 19 subMenusSubOffsetX: 2, 20 subMenusSubOffsetY: -6, 21 subIndicatorsPos: 'append', 22 subIndicatorsText: '...', 23 collapsibleShowFunction: null, 24 collapsibleHideFunction: null, 25 rightToLeftSubMenus: $this.hasClass('navbar-right'), 26 rightToLeftSubMenus: $this.hasClass('navbar-left'), 27 bottomToTopSubMenus: $this.closest('.navbar').hasClass('navbar-fixed-bottom') 28 }) 29 // set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true) 30 .find('a.current').parent().addClass('active'); 31 }) 32 .bind({ 33 // set/unset proper Bootstrap classes for some menu elements 34 'show.smapi': function(e, menu) { 35 var $menu = $(menu), 36 $scrollArrows = $menu.dataSM('scroll-arrows'), 37 obj = $(this).data('smartmenus'); 38 if ($scrollArrows) { 39 // they inherit border-color from body, so we can use its background-color too 40 $scrollArrows.css('background-color', $(document.body).css('background-color')); 41 } 42 $menu.parent().addClass('open' + (obj.isCollapsible() ? ' collapsible' : '')); 43 }, 44 'hide.smapi': function(e, menu) { 45 $(menu).parent().removeClass('open collapsible'); 46 }, 47 // click the parent item to toggle the sub menus (and reset deeper levels and other branches on click) 48 'click.smapi': function(e, item) { 49 var obj = $(this).data('smartmenus'); 50 if (obj.isCollapsible()) { 51 var $item = $(item), 52 $sub = $item.parent().dataSM('sub'); 53 if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) { 54 obj.itemActivate($item); 55 obj.menuHide($sub); 56 return false; 57 } 58 } 59 } 60 }); 61 62 }); 63 64 // fix collapsible menu detection for Bootstrap 3 65 $.SmartMenus.prototype.isCollapsible = function() { 66 return this.$firstLink.parent().css('float') != 'none'; 67 }; 68 69})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.