1(function($){ 2 const dfMenuEx = { 3 navItem: $('.df-menu-nav li'), 4 mMenuButton: $('.df-mobile-menu-button'), 5 subMenu: $('.df-normal-menu-wrap .df-custom-submenu'), 6 ofcButton: $('.df-offcanvas-menu-button'), 7 ofcSubMenu: $('.df-offcanvas-menu .sub-menu'), 8 ofcbMenuItem: $('.df-offcanvas-menu .menu-item a'), 9 mSubMenu: $('.df-mobile-menu .sub-menu'), 10 fullWidthType: $('.df-normal-menu-wrap [data-menu-width-type="full_width"]'), 11 positionBottomCenter: $('.df-normal-menu-wrap [data-submenu-position="bottom_center"]'), 12 searchModalTriggerButton: $('.df-am-search-button'), 13 init: function() { 14 this.subMenuReveal(); 15 this.mobileMenuSlide(); 16 this.revealOfc(); 17 this.searchBoxModal(); 18 this.megaMenuColumn(); 19 this.hideOnSticky(); 20 //this.button_show_on_hover_class_add(); 21 }, 22 hideOnSticky: function() { 23 $(window).on('scroll', function(ev){ 24 if($('.et_pb_sticky_module').hasClass('et_pb_sticky')) { 25 $('.hide_on_sticky').slideUp(); 26 } else { 27 $('.hide_on_sticky').slideDown(); 28 } 29 }) 30 }, 31 megaMenuColumn: function() { 32 $('.df-normal-menu-wrap .df-mega-menu').each(function(i, ele) { 33 const _col_number = Number(ele.dataset.column); 34 let _c = 1; 35 $(this).find(".df-mega-menu-item>li").each(function(index, element){ 36 if(!$(this).attr("data-column")) { 37 $(this).attr("data-column", _c); 38 if(_c === _col_number) { 39 _c = 1; 40 } else { 41 _c++; 42 } 43 } 44 }); 45 if(!$(this).find('>ul').hasClass('col-added')) { 46 $(this).find('[data-column="1"]').wrapAll('<div class="col col-1"></div>'); 47 $(this).find('[data-column="2"]').wrapAll('<div class="col col-2"></div>'); 48 $(this).find('[data-column="3"]').wrapAll('<div class="col col-3"></div>'); 49 $(this).find('[data-column="4"]').wrapAll('<div class="col col-4"></div>'); 50 $(this).find('[data-column="5"]').wrapAll('<div class="col col-5"></div>'); 51 $(this).find('[data-column="6"]').wrapAll('<div class="col col-6"></div>'); 52 $(this).find('[data-column="7"]').wrapAll('<div class="col col-7"></div>'); 53 $(this).find('>ul').addClass('col-added'); 54 } 55 }) 56 }, 57 megaMenu: function($obj) { 58 if($obj.hasClass('df-mega-menu')) { 59 var _dataSet = $obj[0].dataset; 60 var offsetLeft = $obj.offset().left; 61 var containerOffsetLeft = $obj.closest('.row-inner').offset().left; 62 63 if( _dataSet.width === 'full_width' ) { 64 $obj.find(">.sub-menu") 65 .css('width', $(window).width()) 66 .css('left', `-${$obj.offset().left}px`); 67 } else if ( _dataSet.width === 'custom_width' ) { 68 var _width = _dataSet.widthValue ? parseInt(_dataSet.widthValue) : '270'; 69 var _left = '0'; 70 if( _dataSet.alignment === 'bottom_center' ) { 71 _left = `-${Number(_width)/2 - ($obj.width() /2)}`; 72 } else if ( _dataSet.alignment === 'bottom_right' ) { 73 _left = `-${Number(_width) - $obj.width()}`; 74 } 75 $obj.find(">.sub-menu") 76 .css('width', _width) 77 .css('left', `${_left}px`); 78 } else { 79 $obj.find(">.sub-menu") 80 .css('width', $obj.closest('.row-inner').width()) 81 .css('left', -`${offsetLeft - containerOffsetLeft}`); 82 } 83 } 84 }, 85 subMenuReveal: function() { 86 $('.df-mega-menu > .sub-menu').addClass('df-mega-menu-item'); 87 $('.df-mega-menu > .sub-menu .sub-menu').addClass('df-inside-mega-menu');
88 $('.df-normal-menu-wrap .df-menu-nav li').each(function(index, ele){ 89 var $this = $(this); 90 const isInsideMegaMenu = $this.parent().hasClass('df-mega-menu-item') || $this.parent().hasClass('df-inside-mega-menu') || $this.parent().hasClass('col') ? true : false; 91 // reverse direction class for submenu 92 if(!isInsideMegaMenu) { 93 if(($(window).width() - ele.getBoundingClientRect().left) < 420) { 94 $this.addClass('df-submenu-reverse'); 95 } 96 } 97 }); 98 99 $('.df-normal-menu-wrap .df-menu-nav').on({ 100 mouseenter: function() { 101 var _this = $(this); 102 const isInsideMegaMenu = _this.parent().hasClass('df-mega-menu-item') || _this.parent().hasClass('df-inside-mega-menu') || _this.parent().hasClass('col') ? true : false; 103 dfMenuEx.megaMenu(_this); 104 _this.css('overflow', 'visible'); 105 if(!isInsideMegaMenu) { 106 _this.addClass('df-hover') 107 .addClass('df-show-dropdown'); 108 } 109 if(_this.hasClass('menu-item-level-0')) { 110 const _zIndex = _this.closest('.et_pb_section').css('z-index'); 111 if(_zIndex === 'auto') { 112 _this.closest('.et_pb_section').css('z-index', '999'); 113 } else { 114 _this.closest('.et_pb_section').css('z-index', _zIndex); 115 } 116 } else { 117 if(!isInsideMegaMenu) { 118 if(_this.hasClass('df-submenu-reverse')) { 119 _this.find('>.sub-menu').css('right', _this.outerWidth()); 120 } else { 121 _this.find('>.sub-menu').css('left', _this.outerWidth()); 122 } 123 } 124 } 125 _this.find(">.sub-menu").addClass('df-hover'); 126 }, 127 mouseleave: function () { 128 var _this = $(this); 129 const isInsideMegaMenu = _this.parent().hasClass('df-mega-menu-item') || _this.parent().hasClass('df-inside-mega-menu') || _this.parent().hasClass('col') ? true : false; 130 if(!isInsideMegaMenu) { 131 _this.removeClass('df-hover') 132 .removeClass('df-show-dropdown'); 133 } 134 setTimeout(function(){ 135 if(!_this.hasClass('df-show-dropdown')) { 136 _this.find(">.sub-menu").removeClass('df-hover'); 137 } 138 }, 200); 139 } 140 }, 'li'); 141 142 $('.sub-menu').on({ 143 mouseenter: function() { 144 $(this).css('z-index', '99'); 145 }, 146 mouseleave: function () { 147 $(this).css('z-index', ''); 148 } 149 }, '.col'); 150 }, 151 revealOfc: function() { 152 dfMenuEx.ofcButton.on('click', function(ev) { 153 ev.preventDefault(); 154 var ofcClass = $(`.df-offcanvas-wrap[data-menu="${ev.target.dataset.menu}"]`); 155 ofcClass.toggleClass('df-menu-show'); 156 ofcClass.css('z-index', '999999'); 157 ofcClass.find('.df-ofc-close').on('click', function() { 158 ofcClass.removeClass('df-menu-show'); 159 }) 160 }) 161 dfMenuEx.ofcSubMenuReveal(); 162 }, 163 ofcSubMenuReveal: function() { 164 dfMenuEx.ofcbMenuItem.on('click', function(ev) { 165 if(ev.originalEvent.detail === 2 ) return; 166 var _this = $(this); 167 var item = _this.siblings('.sub-menu'); 168 if(item.length > 0) { 169 ev.preventDefault(); 170 _this.siblings('.sub-menu').toggleClass('open'); 171 _this.siblings('.sub-menu').slideToggle("slow") 172 } 173 }) 174 }, 175 mSubmenuReveal: function() { 176 dfMenuEx.mSubMenu.each(function(){ 177 var $this = $(this); 178 $this.siblings("a").on('click', function(ev){ 179 if(ev.originalEvent.detail === 2 ) return; 180 ev.preventDefault(); 181 $this.slideToggle("slow"); 182 $(this).parent().toggleClass('df-show-dropdown'); 183 }) 184 }) 185 }, 186 mobileMenuSlide: function() { 187 dfMenuEx.mMenuButton.on('click', function(ev){ 188 ev.preventDefault(); 189 var mobileMenuClass = ev.target.dataset.menu; 190 $(`.${mobileMenuClass}`).slideToggle('slow') 191 .closest('.et_pb_section').css('z-index', '99'); 192 }) 193 dfMenuEx.mSubmenuReveal(); 194 },
195 searchBoxModal: function() { 196 $('.df-searchbox-style-5.df-am-search').css('opacity', 1); 197 $(document).click(function(event) { 198 const target = event.target; 199 const $popup = $('.df-searchbox-style-5.df-am-search.show'); 200 if(!target.classList.value.includes('df-am-search-button')) { 201 if (!$popup.is(target) && !$popup.has(target).length) { 202 $popup.removeClass('show'); 203 } 204 } 205 }) 206 dfMenuEx.searchModalTriggerButton.on('click', function(ev){ 207 var searchModal = ev.target.dataset.search; 208 $(`.${searchModal}_modal`).toggleClass('show'); 209 }) 210 $('.serach-box-close').on('click', function(){ 211 $(this).parent().removeClass('show'); 212 }) 213 }, 214 button_show_on_hover_class_add: function(){ 215 var selectors = document.querySelectorAll('.difl_advancedmenu'); 216 [].forEach.call(selectors, function (selector, index) { 217 var elements = selector.querySelectorAll('.df-am-col.right .df-menu-button.show_icon_on_hover'); 218 //console.log(elements.length); 219 // Check if any elements were found 220 if (elements.length > 0) { 221 selector.querySelector('.df-am-col.right').classList.add('show_icon_on_hover'); 222 } 223 224 225 }); 226 } 227 } 228 $(window).load(function(){ 229 dfMenuEx.init(); 230 }) 231})(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.