|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/piltdweb1/js/ |
Upload File : |
(function($) {
// init ondomready
$(function() {
// init all menus
$('ul.navbar-nav').each(function() {
var $this = $(this);
$this.addClass('sm').smartmenus({
// these are some good default options that should work for all
// you can, of course, tweak these as you like
subMenusSubOffsetX: 2,
subMenusSubOffsetY: -6,
subIndicatorsPos: 'append',
subIndicatorsText: '...',
collapsibleShowFunction: null,
collapsibleHideFunction: null,
rightToLeftSubMenus: $this.hasClass('navbar-right'),
rightToLeftSubMenus: $this.hasClass('navbar-left'),
bottomToTopSubMenus: $this.closest('.navbar').hasClass('navbar-fixed-bottom')
})
// set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true)
.find('a.current').parent().addClass('active');
})
.bind({
// set/unset proper Bootstrap classes for some menu elements
'show.smapi': function(e, menu) {
var $menu = $(menu),
$scrollArrows = $menu.dataSM('scroll-arrows'),
obj = $(this).data('smartmenus');
if ($scrollArrows) {
// they inherit border-color from body, so we can use its background-color too
$scrollArrows.css('background-color', $(document.body).css('background-color'));
}
$menu.parent().addClass('open' + (obj.isCollapsible() ? ' collapsible' : ''));
},
'hide.smapi': function(e, menu) {
$(menu).parent().removeClass('open collapsible');
},
// click the parent item to toggle the sub menus (and reset deeper levels and other branches on click)
'click.smapi': function(e, item) {
var obj = $(this).data('smartmenus');
if (obj.isCollapsible()) {
var $item = $(item),
$sub = $item.parent().dataSM('sub');
if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) {
obj.itemActivate($item);
obj.menuHide($sub);
return false;
}
}
}
});
});
// fix collapsible menu detection for Bootstrap 3
$.SmartMenus.prototype.isCollapsible = function() {
return this.$firstLink.parent().css('float') != 'none';
};
})(jQuery);