ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,2 @@
/* perfect-scrollbar v0.7.1 */
.ps{-ms-touch-action:auto;touch-action:auto;overflow:hidden !important;-ms-overflow-style:none}@supports (-ms-overflow-style: none){.ps{overflow:auto !important}}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.ps{overflow:auto !important}}.ps.ps--active-x>.ps__scrollbar-x-rail,.ps.ps--active-y>.ps__scrollbar-y-rail{display:block;background-color:transparent}.ps.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail{background-color:#eee;opacity:.9}.ps.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail>.ps__scrollbar-x{background-color:#999;height:11px}.ps.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail{background-color:#eee;opacity:.9}.ps.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail>.ps__scrollbar-y{background-color:#999;width:11px}.ps>.ps__scrollbar-x-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;bottom:0px;height:15px}.ps>.ps__scrollbar-x-rail>.ps__scrollbar-x{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;bottom:2px;height:6px}.ps>.ps__scrollbar-x-rail:hover>.ps__scrollbar-x,.ps>.ps__scrollbar-x-rail:active>.ps__scrollbar-x{height:11px}.ps>.ps__scrollbar-y-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;right:0;width:15px}.ps>.ps__scrollbar-y-rail>.ps__scrollbar-y{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;right:2px;width:6px}.ps>.ps__scrollbar-y-rail:hover>.ps__scrollbar-y,.ps>.ps__scrollbar-y-rail:active>.ps__scrollbar-y{width:11px}.ps:hover.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail{background-color:#eee;opacity:.9}.ps:hover.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail>.ps__scrollbar-x{background-color:#999;height:11px}.ps:hover.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail{background-color:#eee;opacity:.9}.ps:hover.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail>.ps__scrollbar-y{background-color:#999;width:11px}.ps:hover>.ps__scrollbar-x-rail,.ps:hover>.ps__scrollbar-y-rail{opacity:.6}.ps:hover>.ps__scrollbar-x-rail:hover{background-color:#eee;opacity:.9}.ps:hover>.ps__scrollbar-x-rail:hover>.ps__scrollbar-x{background-color:#999}.ps:hover>.ps__scrollbar-y-rail:hover{background-color:#eee;opacity:.9}.ps:hover>.ps__scrollbar-y-rail:hover>.ps__scrollbar-y{background-color:#999}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,161 @@
/**
* Olegnax
*
* NOTICE OF LICENSE
*
* This source file is subject to the Olegnax.com license that is
* available through the world-wide-web at this URL:
* https://www.olegnax.com/license
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Olegnax
* @package Olegnax_MegaMenu
* @copyright Copyright (c) 2010-2021 Olegnax (http://www.olegnax.com/)
* @license https://www.olegnax.com/license
*/
@ox-mega-menu__column-padding: 15px;
@ox-mega-menu__transition: ~"all 600ms ease-in-out";
@ox-mega-menu__transition-hover: ~"all 10ms ease-in-out";
@ox-mega-menu__animation-speed: 0.5s;
//
// Navigation
// _____________________________________________
/* Toggle Plus Icon */
@ox-mega-menu-toggle-icon__show: true;
@ox-mega-menu-toggle-icon__width: 8px;
@ox-mega-menu-toggle-icon__height: 2px;
@ox-mega-menu-toggle-icon__color: currentColor;
@ox-mega-menu-arrow-icon__color: currentColor;
//@font-family__sans-serif: Arial, sans-serif;
@ox-mega-menu__font-name: 'Open Sans', @font-family__sans-serif;
@ox-mega-menu__background: transparent;
//Label
@ox-mega-menu-label__color: white;
@ox-mega-menu-label_background: red;
@ox-mega-menu-label__font-size: 11px;
@ox-mega-menu-label__padding: 3px 5px 4px 5px;
@ox-mega-menu-label__border-radius: 0;
@ox-mega-menu-label__top: -7px;
@ox-mega-menu-label__right: 0;
// Level0
@ox-mega-menu-level0-item__font-size: 14px;
@ox-mega-menu-level0-item__font-weight: @font-weight__bold;
@ox-mega-menu-level0-item__height: 44px;
@ox-mega-menu-level0-item__margin: 0;
@ox-mega-menu-level0-item__padding: 0 14px;
@ox-mega-menu-level0-item__text-transform: uppercase;
@ox-mega-menu-level0-item__letter-spacing: 0;
@ox-mega-menu-level0-item__background: transparent;
@ox-mega-menu-level0-item__color: #333333;
@ox-mega-menu-level0-item__active__background: #333333;
@ox-mega-menu-level0-item__active__color: #ffffff;
@ox-mega-menu-level0-item__hover__background: #f7f7f7;
@ox-mega-menu-level0-item__hover__color: #333333;
// Submenu Items
@ox-mega-menu-submenu-item__background: transparent;
@ox-mega-menu-submenu-item__border: 1px solid #f1f1f1;
@ox-mega-menu-submenu-item__padding: 10px 15px;
@ox-mega-menu-submenu-item__margin: 0;
@ox-mega-menu-submenu-item__font-size: 14px;
@ox-mega-menu-submenu-item__font-weight: @font-weight__heavier;
@ox-mega-menu-submenu-item__color: #333333;
@ox-mega-menu-submenu-item__height: 44px;
@ox-mega-menu-submenu-item__active__background: #333333;
@ox-mega-menu-submenu-item__active__color: #ffffff;
@ox-mega-menu-submenu-item__hover__background: #f7f7f7;
@ox-mega-menu-submenu-item__hover__color: #000000;
@ox-mega-menu-submenu-item__text-transform: unset;
@ox-mega-menu-submenu-item__letter-spacing: 0;
@ox-mega-menu-submenu__padding: 0;
//
// Desktop Navigation
// ---------------------------------------------
@ox-mega-menu-navigation__min-height: 55px;
@ox-mega-menu-navigation__padding: 0;
@ox-mega-menu-arrow-icon__show: true;
// Drop Down
@ox-mega-menu-submenu__background: #ffffff;
@ox-mega-menu-desktop-submenu__padding: 20px;
@ox-mega-menu-desktop-submenu-mega__padding: 35px;
@ox-mega-menu-submenu__width: 290px;
@ox-mega-menu-submenu__shadow: 0px 4px 22px 0px rgba(0, 0, 0, 0.08);
// Level0
@ox-mega-menu-desktop-level0-item__font-size: 16px;
@ox-mega-menu-desktop-level0-item__font-weight: @font-weight__bold;
@ox-mega-menu-desktop-level0-item__height: 44px;
@ox-mega-menu-desktop-level0-item__margin: 0;
@ox-mega-menu-desktop-level0-item__padding: 0 14px;
@ox-mega-menu-desktop-level0-item__text-transform: uppercase;
@ox-mega-menu-desktop-level0-item__letter-spacing: 0;
@ox-mega-menu-desktop-level0-item__background: transparent;
@ox-mega-menu-desktop-level0-item__color: #333333;
@ox-mega-menu-desktop-level0-item__active__background: #333333;
@ox-mega-menu-desktop-level0-item__active__color: #ffffff;
@ox-mega-menu-desktop-level0-item__hover__background: #f7f7f7;
@ox-mega-menu-desktop-level0-item__hover__color: #333333;
// Submenu Items
@ox-mega-menu-desktop-submenu-item__background: @ox-mega-menu-submenu-item__background;
@ox-mega-menu-desktop-submenu-item__border: @ox-mega-menu-submenu-item__border;
@ox-mega-menu-desktop-submenu-item__padding: @ox-mega-menu-submenu-item__padding;
@ox-mega-menu-desktop-submenu-item__margin: @ox-mega-menu-submenu-item__margin;
@ox-mega-menu-desktop-submenu-item__font-size: @ox-mega-menu-submenu-item__font-size;
@ox-mega-menu-desktop-submenu-item__font-weight: @ox-mega-menu-submenu-item__font-weight;
@ox-mega-menu-desktop-submenu-item__text-transform: unset;
@ox-mega-menu-desktop-submenu-item__letter-spacing: 0;
@ox-mega-menu-desktop-submenu-item__color: @ox-mega-menu-submenu-item__color;
@ox-mega-menu-desktop-submenu-item__active__background: @ox-mega-menu-submenu-item__active__background;
@ox-mega-menu-desktop-submenu-item__active__color: @ox-mega-menu-submenu-item__active__color;
@ox-mega-menu-desktop-submenu-item__hover__background: @ox-mega-menu-submenu-item__hover__background;
@ox-mega-menu-desktop-submenu-item__hover__color: @ox-mega-menu-submenu-item__hover__color;
// Level1 item in Mega Drop Down
@ox-mega-menu-desktop-submenu-mega-level1-item__font-size: 14px;
@ox-mega-menu-desktop-submenu-mega-level1-item__font-weight: @font-weight__bold;
@ox-mega-menu-desktop-submenu-mega-level1-item__margin: 0;
@ox-mega-menu-desktop-submenu-mega-level1-item__padding: 15px;
@ox-mega-menu-desktop-submenu-mega-level1-item__color: #333333;
@ox-mega-menu-desktop-submenu-mega-level1-item__background: transparent;
@ox-mega-menu-desktop-submenu-mega-level1-item__text-transform: uppercase;
@ox-mega-menu-desktop-submenu-mega-level1-item__letter-spacing: 0;
@ox-mega-menu-desktop-submenu-mega-level1-item__active__background: @ox-mega-menu-desktop-submenu-item__active__background;
@ox-mega-menu-desktop-submenu-mega-level1-item__active__color: @ox-mega-menu-desktop-submenu-item__active__color;
@ox-mega-menu-desktop-submenu-mega-level1-item__hover__background: @ox-mega-menu-desktop-submenu-item__hover__background;
@ox-mega-menu-desktop-submenu-mega-level1-item__hover__color: @ox-mega-menu-desktop-submenu-item__hover__color;
// Level1 Submenu item in Mega Drop Down
@ox-mega-menu-desktop-submenu-mega-level1-submenu__font-size: @ox-mega-menu-desktop-submenu-item__font-size;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__font-weight: @ox-mega-menu-desktop-submenu-item__font-weight;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__padding: 6px 8px;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__margin: @ox-mega-menu-desktop-submenu-item__margin;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__color: @ox-mega-menu-desktop-submenu-item__color;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__background: @ox-mega-menu-desktop-submenu-item__background;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__text-transform: @ox-mega-menu-desktop-submenu-item__text-transform;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__letter-spacing: @ox-mega-menu-desktop-submenu-item__letter-spacing;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__border: @ox-mega-menu-desktop-submenu-item__border;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__active__background: @ox-mega-menu-desktop-submenu-item__active__background;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__active__color: @ox-mega-menu-desktop-submenu-item__active__color;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__hover__background: @ox-mega-menu-desktop-submenu-item__hover__background;
@ox-mega-menu-desktop-submenu-mega-level1-submenu__hover__color: @ox-mega-menu-desktop-submenu-item__hover__color;
+596
View File
@@ -0,0 +1,596 @@
define([
'jquery',
'matchMedia',
'jquery-ui-modules/widget',
'jquery-ui-modules/core',
'plugins/velocity',
'plugins/scrollbar',
], function ($, mediaCheck) {
'use strict';
$.widget('ox.OxMegaMenu', {
options: {
direction: 'horizontal',
positionHorizontal: 'left',
btn: false,
actionActive: 'active',
header: '.container',
toggleTransitionDuration: 400,
mediaBreakpoint: 768,
classNavigation: '.ox-megamenu-navigation',
classDropdown: '.ox-megamenu__dropdown',
},
_alignFunctions: {
'horizontal': {
'container-left': function () {
var $cont = $(this.options.header);
if ($cont.length) {
var cont_l = $cont[0].getBoundingClientRect().left,
ox_megamenu_l = this.element[0].getBoundingClientRect().left;
return {
left: cont_l - ox_megamenu_l
};
} else {
console.warn('Header container not found. Please set correct header selector in Olegnax / Megamenu / Configuration.')
}
},
'container-right': function () {
var $cont = $(this.options.header),
cont_r = $cont[0].getBoundingClientRect().right,
ox_megamenu_r = this.element[0].getBoundingClientRect().right;
return {
left: 'auto',
right: ox_megamenu_r - cont_r
};
},
'container-center': function () {
var $cont = $(this.options.header),
cont_l = $cont[0].getBoundingClientRect().left,
cont_w = $cont.innerWidth(),
ox_megamenu_l = this.element[0].getBoundingClientRect().left;
return {
left: cont_l - ox_megamenu_l + cont_w / 2
};
},
'window-left': function () {
var ox_megamenu_l = this.element[0].getBoundingClientRect().left;
return {
left: ox_megamenu_l * -1
};
},
'window-right': function () {
var windowWidth = window.innerWidth - this._scrollWidth,
ox_megamenu_r = this.element[0].getBoundingClientRect().right;
return {
left: 'auto',
right: (windowWidth - ox_megamenu_r) * -1
};
},
'window-center': function () {
var windowWidth = window.innerWidth - this._scrollWidth,
ox_megamenu_l = this.element[0].getBoundingClientRect().left;
return {
left: ox_megamenu_l * -1 + windowWidth / 2
};
},
'define': 'menu-left',
},
'vertical': {
'container-left': function () {
var $cont = $(this.options.cont),
cont_l = $cont[0].getBoundingClientRect().left,
ox_megamenu_l = this.element[0].getBoundingClientRect().left,
ox_megamenu_w = this.element.innerWidth();
return {
left: 'auto',
right: ox_megamenu_l - cont_l + ox_megamenu_w
};
},
'container-right': function () {
var $cont = $(this.options.cont),
cont_r = $cont[0].getBoundingClientRect().right,
ox_megamenu_r = this.element[0].getBoundingClientRect().right,
ox_megamenu_w = this.element.innerWidth();
return {
left: cont_r - ox_megamenu_r + ox_megamenu_w
};
},
'define': 'container-left',
}
},
_create: function () {
var _self = this,
$ox_megamenu = this.element,
$ox_megamenu__navigation = $ox_megamenu.find(this.options.classNavigation),
$ox_megamenu__dropdown = $ox_megamenu.find(this.options.classDropdown),
$ox_megamenu__submenu = $ox_megamenu__dropdown.find('.ox-submenu');
this._getScrollWidth();
mediaCheck({
media: '(min-width:' + this.options.mediaBreakpoint + 'px)',
entry: $.proxy(function () {
this._toggleDesktopMode();
}, this),
exit: $.proxy(function () {
this._toggleMobileMode();
}, this),
});
this._widthHandlers({
elem: $ox_megamenu__navigation,
delegate: '>li, li.ox-dropdown--megamenu',
namespace: 'togglemegamenu',
desktop: true,
events: {
'mouseenter': function (e) {
_self._showMM(this);
},
'mouseleave': function (e) {
_self._hideMM(this);
},
'touchstart': function (e) {
if ($(this).hasClass('ox-megamenu--opened') || ($(this).find('> a').data('url') == 'custom' && !$(this).hasClass('parent'))) {
return;
}
e.preventDefault();
_self._showMM(this);
}
}
});
//dropdown handlers
this._widthHandlers({
elem: $ox_megamenu__submenu.parent('li'),
namespace: 'toggledropdown',
desktop: true,
events: {
'mouseenter': function (e) {
_self._showDD(this);
},
'mouseleave': function (e) {
_self._hideDD(this);
},
'touchstart': function (e) {
if ($(this).hasClass('js-touch')) {
return;
}
$(this).addClass('js-touch');
e.preventDefault();
_self._showDD(this);
}
}
});
this._widthHandlers({
elem: $ox_megamenu.find('li.parent > a, li.ox-dropdown--megamenu > a'),
namespace: 'togglelist',
desktop: false,
events: {
'click': function (e) {
if (('A' === e.target.tagName || 'SPAN' === e.target.tagName) && $(this).parent().hasClass('ox-megamenu--opened') || !$(this).closest('li').eq(0).find('.submenu, .ox-submenu, .ox-megamenu__dropdown').length)
return;
_self._toggleList(this);
e.preventDefault();
return false;
},
}
});
$(this.window).trigger('resize');
},
_getScrollWidth: function () {
var $tempElement = $('<div>').css({
overflowY: 'scroll',
width: '50px',
height: '50px',
visibility: 'hidden'
});
$('body').append($tempElement);
this._scrollWidth = $tempElement[0].offsetWidth - $tempElement[0].clientWidth;
$tempElement.remove();
},
_toggleDesktopMode: function () {
this.is_desktop = true;
this._hideAllMM();
this.element.find('.ox-megamenu--opened').removeClass('ox-megamenu--opened');
},
_toggleMobileMode: function () {
this.is_desktop = false;
this._hideAllMM();
var dropdown = this.element.find('.ox-megamenu__dropdown');
dropdown.css({'width': '', 'left': ''});
dropdown.find('.ox-megamenu-list').first().css({'width': ''});
dropdown.find('.ox-megamenu-block-left, .ox-megamenu-block-right').css({'width': ''});
},
_hideAllMM: function () {
this._hideMM(this.element.find(this.options.classNavigation).find('> li'), true);
},
_toggleList: function (btn) {
var _self = this,
$ox_megamenu = this.element,
$btn = $(btn),
$li = $btn.parent(),
$lvl = $li.find('> *:not(a)');
$lvl.css('height', '');
$lvl.velocity('stop');
if ($li.hasClass('ox-megamenu--opened')) {
var $li_other = $li.find('.ox-megamenu--opened');
$li.removeClass('ox-megamenu--opened');
$lvl.velocity('slideUp', {
duration: _self.options.toggleTransitionDuration,
complete: function () {
$li_other.removeClass('ox-megamenu--opened').removeAttr('style');
$li_other.find('ul').removeAttr('style');
if($ox_megamenu.hasClass('ps-enabled')){
$ox_megamenu.perfectScrollbar('update');
}
}
});
} else {
$lvl.velocity('slideDown', {
duration: _self.options.toggleTransitionDuration,
complete: function () {
if($ox_megamenu.hasClass('ps-enabled')){
$ox_megamenu.perfectScrollbar('update');
}
}
});
$li.addClass('ox-megamenu--opened');
$('body').trigger('contentUpdated');
}
},
_widthHandlers: function (obj) {
var _self = this;
$(window).on('resize.handlerswidth', function () {
if (obj.desktopBp === _self.is_desktop)
return;
else
obj.desktopBp = _self.is_desktop;
var $elem = $(obj.elem),
ns = obj.namespace ? '.' + obj.namespace : '';
if (obj.desktop === _self.is_desktop) {
$.each(obj.events, function (key, val) {
$elem.on(key + ns, obj.delegate, val);
});
} else {
$.each(obj.events, function (key) {
$elem.off(key + ns);
});
}
});
},
_showMM: function (element) {
var _self = this,
$element = $(element),
$mm = $element.children('.ox-megamenu__dropdown'),
$mmp = $mm.parents('.ox-megamenu__dropdown').add($mm),
$ox_megamenu__dropdown = this.element.find('.ox-megamenu__dropdown');
if (!$mm.length)
return;
$mm.off('transitionend.mmclose');
$ox_megamenu__dropdown.not($mmp).removeClass('opened animate');
if (this.options.beforeOpenMM)
this.options.beforeOpenMM($mm, $element);
this.currentButton = $element;
this.currentMegamenu = $mm;
$element.addClass('ox-megamenu--opened');
$mm.addClass('opened');
$('body').addClass('ox-mm-opened');
this._beforeOpenMM();
var $menu_item = $element.parents('.category-item:first');
if($menu_item.length && $menu_item.hasClass('ox-dropdown--megamenu')){
this.setVerticalAlign();
}
$mm.one('transitionend.mmopen', function () {
_self._afterOpenMM();
if (_self.options.afterOpenMM)
_self.options.afterOpenMM($mm, $element);
});
$mm.find('.owl-carousel:not(.owl-mm-reloaded), .owl-loaded:not(.owl-mm-reloaded)').trigger('refresh.owl.carousel').addClass('owl-mm-reloaded');
$mm.addClass('animate');
},
_hideMM: function (btn, is_fast) {
var _self = this,
$btn = $(btn),
$mm = $btn.find('.ox-megamenu__dropdown');
if (!$mm.length)
return;
$mm.off('transitionend.mmopen');
if (this.options.beforeCloseMM)
this.options.beforeCloseMM($mm, $btn);
this.currentButton = $btn;
this.currentMegamenu = $mm;
this._beforeCloseMM();
$mm.one('transitionend.mmclose', function () {
$mm.removeClass('opened');
$('body').removeClass('ox-mm-opened');
$btn.removeClass('ox-megamenu--opened');
_self._afterCloseMM();
if (_self.options.afterCloseMM)
_self.options.afterCloseMM($mm, $btn);
});
$mm.removeClass('animate');
if (is_fast)
$mm.trigger('transitionend.mmclose');
},
_isNumeric: function (val) {
return Number(parseFloat(val)) === val;
},
setVerticalAlign: function() {
if(this.currentButton.hasClass('ox-mm__lvl1-top') || this.currentButton.hasClass('ox-mm__lvl1-top-stretch') ){
var $_parent = $(this.currentButton.closest(this.options.classDropdown));
if ($_parent.length) {
this.currentMegamenu.css('top', (this.currentButton[0].getBoundingClientRect().top - $_parent[0].getBoundingClientRect().top) * -1 );
}
}
},
_beforeOpenMM: function () {
var _self = this;
function setWidth() {
var mmWidth = _self.currentMegamenu.data('ox-mm-w') || _self.currentMegamenu.data('oxMmW'),
w_funcs = _self._widthFunctions[_self.options.direction],
set_w;
if (w_funcs.hasOwnProperty(mmWidth))
set_w = w_funcs[mmWidth].apply(_self, arguments);
else if (_self._isNumeric(mmWidth))
set_w = mmWidth;
if (set_w) {
if (mmWidth === 'column-max-width') {
var mm_list = _self.currentMegamenu.find('.ox-megamenu-list').first();
var mm_block_left = _self.currentMegamenu.find('.ox-megamenu-block-left');
var mm_block_right = _self.currentMegamenu.find('.ox-megamenu-block-right');
mm_list.innerWidth(set_w);
mm_block_left.innerWidth(set_w);
mm_block_right.innerWidth(set_w);
_self.currentMegamenu.css('width', 'auto');
} else {
_self.currentMegamenu.innerWidth(set_w);
}
}
}
function setAlign(attr) {
var align = _self.currentButton.data(attr),
align_func = _self._alignFunctions[_self.options.direction],
align = align || align_func['define'],
css;
if (align_func.hasOwnProperty(align)) {
css = align_func[align].apply(_self);
if (css) {
_self.currentMegamenu.css(css);
}
}
}
function checkWidth() {
var $mm = _self.currentMegamenu,
mmLeft = $mm[0].getBoundingClientRect().left,
mmRight = $mm[0].getBoundingClientRect().right,
mmWidth = $mm.innerWidth(),
windowWidth = window.innerWidth - _self._scrollWidth;
if (mmWidth > windowWidth) {
if (mmLeft > 0) {
$mm.innerWidth(windowWidth - mmLeft);
} else if (mmRight < windowWidth) {
$mm.innerWidth(windowWidth - (windowWidth - mmRight));
} else {
$mm.innerWidth(windowWidth);
}
} else if (mmLeft < 0) {
$mm.innerWidth(mmWidth + mmLeft);
} else if (mmRight > windowWidth) {
$mm.innerWidth(mmWidth - (mmRight - windowWidth));
}
}
setWidth();
setAlign('ox-mm-a-h');
checkWidth();
this._toggleTransition('show');
},
_afterOpenMM: function () {
this._checkWindowLimit();
this._toggleTransition('show');
},
_beforeCloseMM: function () {
this._toggleTransition('hide');
},
_afterCloseMM: function () {
var $mm = this.currentMegamenu;
// $mm.removeAttr('style');
$mm.css('max-height', '');
if ($mm.hasClass('ox-megamenu--scroll')) {
$mm.removeClass('ox-megamenu--scroll');
$mm.perfectScrollbar('destroy').removeClass('ps');
}
},
_widthFunctions: {
'horizontal': {
'menu': function () {
return this.element.innerWidth();
},
'fullwidth': function () {
return window.innerWidth - this._scrollWidth;
},
'container': function () {
return $(this.options.header).innerWidth();
},
'column-max-width': function () {
var mm_cw = this.currentMegamenu.data('ox-mm-cw') || this.currentMegamenu.data('oxMmCw'),
mm_col = this.currentMegamenu.data('ox-mm-col') || this.currentMegamenu.data('oxMmCol');
if (mm_cw) {
if (mm_col) {
return mm_cw * mm_col;
} else {
return mm_cw;
}
}
},
'custom': function (mm) {
return this.currentMegamenu.data('ox-mm-cw') || this.currentMegamenu.data('oxMmCw');
},
},
'vertical': {
'fullwidth': function () {
switch (this.options.positionHorizontal) {
case 'right':
return window.innerWidth - this._scrollWidth - (window.innerWidth - this._scrollWidth - this.element[0].getBoundingClientRect().left);
default:
return window.innerWidth - this.element[0].getBoundingClientRect().right - this._scrollWidth;
}
},
},
},
_toggleTransition: function (act) {
var $btn = this.currentButton,
$mm = this.currentMegamenu,
$trns = $btn.find('.ox-megamenu-trns');
switch (act) {
case 'show':
var set_obj = {},
btn_pos = $btn[0].getBoundingClientRect(),
mm_pos = $mm[0].getBoundingClientRect();
if (this.options.direction === 'horizontal') {
set_obj.width = $mm.innerWidth();
set_obj.height = mm_pos.top - btn_pos.bottom + 10;
if (mm_pos.left > btn_pos.left) {
set_obj.width += mm_pos.left - btn_pos.left;
} else if (mm_pos.right < btn_pos.right) {
set_obj.width += btn_pos.right - mm_pos.right;
set_obj.left = (btn_pos.left - mm_pos.left) * -1;
} else {
set_obj.left = (btn_pos.left - mm_pos.left) * -1;
}
} else if (this.options.direction === 'vertical') {
set_obj.height = $mm.innerHeight();
if (this.options.positionHorizontal === 'left') {
set_obj.width = mm_pos.left - btn_pos.right;
} else if (this.options.positionHorizontal === 'right') {
set_obj.width = btn_pos.left - mm_pos.right;
}
if (mm_pos.top > btn_pos.top) {
set_obj.height += mm_pos.top - btn_pos.top;
} else if (mm_pos.bottom < btn_pos.bottom) {
set_obj.height += btn_pos.bottom - mm_pos.bottom;
set_obj.top = (btn_pos.top - mm_pos.top) * -1;
} else {
set_obj.top = (btn_pos.top - mm_pos.top) * -1;
}
}
$trns.css(set_obj);
break;
case 'hide':
$trns.removeAttr('style');
break;
}
},
_checkWindowLimit: function () {
if (this.options.direction !== 'horizontal' || !this.element.find(this.options.classNavigation).parent().hasClass('ps-enabled'))
return;
var $mm = this.currentMegamenu,
mm_b = $mm[0].getBoundingClientRect().bottom,
wind_h = window.innerHeight;
if (mm_b > wind_h) {
var mm_h = $mm.innerHeight();
$mm.addClass('ox-megamenu--scroll');
$mm.css({'max-height': mm_h - (mm_b - wind_h)});
$mm.perfectScrollbar({
suppressScrollX: true
});
}
},
_showDD: function (btn) {
var $btn = $(btn),
$dd = $btn.find('> ul'),
$mm = this.currentMegamenu;
$dd.off('transitionend.ddclose');
$dd.addClass('opened');
$('body').addClass('ox-mm-opened');
if ($mm.hasClass('ps') && $mm.hasClass('ox-megamenu-mm--simple')) {
$mm.perfectScrollbar('update');
} else {
var dd_pos = $dd[0].getBoundingClientRect(),
windowWidth = window.innerWidth - this._scrollWidth,
dd_lim_l = (dd_pos.left - $dd.innerWidth() - $dd.parents('ul').first().innerWidth()) < 0,
dd_lim_r = dd_pos.right > windowWidth,
is_prnt_reverse = $dd.parents('ul').first().hasClass('ox-megamenu-dd--reverse');
if (dd_lim_r || (is_prnt_reverse && !dd_lim_l))
$dd.addClass('ox-megamenu-dd--reverse');
}
$dd.addClass('animate');
},
_hideDD: function (btn) {
var $btn = $(btn),
$dd = $btn.find('> ul'),
$mm = this.currentMegamenu;
$dd.one('transitionend.ddclose', function (e) {
$dd.removeClass('opened ox-megamenu-dd--reverse').css('max-height', '');
if ($mm.hasClass('ps'))
$mm.perfectScrollbar('update');
});
$dd.removeClass('animate');
},
_setOption: function (key, value, is_attr) {
if (is_attr && !value)
return;
$.Widget.prototype._setOption.apply(this, arguments);
},
destroy: function () {
$.Widget.prototype.destroy.call(this);
}
});
return $.ox.OxMegaMenu;
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long