-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.smartmenus.bootstrap-4.min.js
3 lines (3 loc) · 2.89 KB
/
jquery.smartmenus.bootstrap-4.min.js
1
2
3
/*! SmartMenus jQuery Plugin Bootstrap 4 Addon - v0.1.1 - November 3, 2022
* http://www.smartmenus.org/
* Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */!function(a){"function"==typeof define&&define.amd?define(["jquery","smartmenus"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return a.extend(a.SmartMenus.Bootstrap={},{keydownFix:!1,init:function(){var b=a("ul.navbar-nav:not([data-sm-skip])");b.each(function(){function b(){e.find("a.current").each(function(){var b=a(this);(b.hasClass("dropdown-item")?b:b.parent()).addClass("active")}),e.find("a.has-submenu").each(function(){var b=a(this);b.is('[data-toggle="dropdown"]')&&b.dataSM("bs-data-toggle-dropdown",!0).removeAttr("data-toggle"),!g&&b.hasClass("dropdown-toggle")&&b.dataSM("bs-dropdown-toggle",!0).removeClass("dropdown-toggle")})}function c(){e.find("a.current").each(function(){var b=a(this);(b.hasClass("active")?b:b.parent()).removeClass("active")}),e.find("a.has-submenu").each(function(){var b=a(this);b.dataSM("bs-dropdown-toggle")&&b.addClass("dropdown-toggle").removeDataSM("bs-dropdown-toggle"),b.dataSM("bs-data-toggle-dropdown")&&b.attr("data-toggle","dropdown").removeDataSM("bs-data-toggle-dropdown")})}function d(a){var b=f.getViewportWidth();(b!=i||a)&&(f.isCollapsible()?e.addClass("sm-collapsible"):e.removeClass("sm-collapsible"),i=b)}var e=a(this),f=e.data("smartmenus");if(!f){var g=e.is("[data-sm-skip-collapsible-behavior]"),h=e.hasClass("ml-auto")||e.prevAll(".mr-auto").length>0;e.smartmenus({subMenusSubOffsetX:2,subMenusSubOffsetY:-9,subIndicators:!g,collapsibleShowFunction:null,collapsibleHideFunction:null,rightToLeftSubMenus:h,bottomToTopSubMenus:e.closest(".fixed-bottom").length>0,bootstrapHighlightClasses:"text-dark bg-light"}).on({"show.smapi":function(b,c){var d=a(c),e=d.dataSM("scroll-arrows");e&&e.css("background-color",d.css("background-color")),d.parent().addClass("show"),f.opts.keepHighlighted&&d.dataSM("level")>2&&d.prevAll("a").addClass(f.opts.bootstrapHighlightClasses)},"hide.smapi":function(b,c){var d=a(c);d.parent().removeClass("show"),f.opts.keepHighlighted&&d.dataSM("level")>2&&d.prevAll("a").removeClass(f.opts.bootstrapHighlightClasses)}}),f=e.data("smartmenus"),b(),f.refresh=function(){a.SmartMenus.prototype.refresh.call(this),b(),d(!0)},f.destroy=function(b){c(),a.SmartMenus.prototype.destroy.call(this,b)},g&&(f.opts.collapsibleBehavior="toggle");var i;d(),a(window).on("resize.smartmenus"+f.rootId,d)}}),b.length&&!a.SmartMenus.Bootstrap.keydownFix&&(a(document).off("keydown.bs.dropdown.data-api",".dropdown-menu"),a.fn.dropdown&&a.fn.dropdown.Constructor&&"function"==typeof a.fn.dropdown.Constructor._dataApiKeydownHandler&&a(document).on("keydown.bs.dropdown.data-api",".dropdown-menu.show",a.fn.dropdown.Constructor._dataApiKeydownHandler),a.SmartMenus.Bootstrap.keydownFix=!0)}}),a(a.SmartMenus.Bootstrap.init),a});