1function openRTMEGAmobile() { 2 document.querySelectorAll('.enabled-mobile-menu .mobile-menu-area').forEach(element => { 3 element.classList.add('opened'); 4 }); 5} 6 7function closeRTMEGAmobile() { 8 document.querySelectorAll('.enabled-mobile-menu .mobile-menu-area').forEach(element => { 9 element.classList.remove('opened'); 10 }); 11} 12(function ($) { 13 14 RTmegaMenu = { 15 init: function () { 16 this.enableAccordion(); 17 this.enableHeaderScript(); 18 $(document) 19 .on('click.RTmegaMenu', '.rtmega-menu-vertical-expand-button-wrapper button', this.expandVerticalMenu) 20 .on('click.RTmegaMenu', '.rtmega-menu-top-style-cls', this.closeRTMEGAmobile_top); 21 22 // compatible with astra theme mobile menu 23 $(document).on('click.RTmegaMenu', '.ast-mobile-header-wrap .main-header-menu-toggle', this.openCloseRTMEGAmobile_astra); 24 25 }, 26 openCloseRTMEGAmobile_astra: function (e) { 27 e.preventDefault(); 28 console.log("openRTMEGAmobile_astra"); 29 document.querySelectorAll('.ast-mobile-header-wrap .ast-mobile-header-content').forEach(element => { 30 element.classList.toggle('opened'); 31 }); 32 document.querySelectorAll('.ast-mobile-header-content .mobile-menu-area').forEach(element => { 33 element.classList.toggle('opened'); 34 }); 35 }, 36 expandVerticalMenu: function (e) { 37 e.preventDefault(); 38 let widgetID = $(this).attr('widget_id'); 39 $('.enabled-vertical-menu .vertical-expaned-menu-area' + '.' + widgetID + ' .rtmega-menu-vertical-expanded').toggleClass('opened'); 40 if ($('.expand-position-top').length) { 41 $('.rtmega-menu-top-style-cls').addClass("top-opened"); 42 } 43 }, 44 enableAccordion: function ($scope) { 45 var $selector = $(".rtmega-menu-area .mobile-menu-area .rtmega-megamenu, .rtmega-menu-area .rtmega-megamenu.vertical.vertical-submenu-expand-mode-click"); 46 if ($scope) { 47 $selector = $scope.find(".rtmega-menu-area .mobile-menu-area .rtmega-megamenu, .rtmega-menu-area .rtmega-megamenu.vertical.vertical-submenu-expand-mode-click"); 48 } 49 // Prevent double initialization 50 $selector = $selector.not('.mg-accordion'); 51 if ($selector.length) { 52 $selector.mgaccordion({ 53 theme: 'tree', 54 }); 55 } 56 }, 57 closeRTMEGAmobile_top: function (e) { 58 e.preventDefault(); 59 if ($('.expand-position-top').length) { 60 $('.rtmega-menu-top-style-cls').removeClass("top-opened"); 61 $('.rtmega-menu-vertical-expanded.expand-position-top').removeClass("opened"); 62 } 63 }, 64 enableHeaderScript: function () { 65 let headerInnerWidth = $('.header-inner .e-con > .e-con-inner').width(); 66 $('.sub-menu.rtmegamenu-contents.full-width-mega-menu').css('width', headerInnerWidth + 'px'); 67 $('.sub-menu.rtmegamenu-contents.full-width-mega-menu').css('max-width', headerInnerWidth + 'px'); 68 $('.elementor-widget.elementor-widget-rt-mega-navigation-menu').css('position', 'static'); 69 $('.elementor-widget.elementor-widget-rt-mega-navigation-menu').parent().css('position', 'static'); 70 71 $(window).resize(function () { 72 let headerInnerWidth = $('.header-inner .e-con > .e-con-inner').width(); 73 $('.sub-menu.rtmegamenu-contents.full-width-mega-menu').css('width', headerInnerWidth + 'px'); 74 $('.sub-menu.rtmegamenu-contents.full-width-mega-menu').css('max-width', headerInnerWidth + 'px'); 75 }); 76 } 77 }; 78 79 RTmegaMenu.init(); 80 81 // vertical-submenu-expand-mode-hover mobile device click to sub menu open 82 const $menu = $('.rtmega-menu-area .rtmega-megamenu.vertical.vertical-submenu-expand-mode-hover'); 83 if ($menu.length) { 84 const RTMEGhoverExpandClassAdd = () => { 85 $menu.toggleClass('rtmega-expand-hover-submenu-open-click', window.innerWidth <= 1024); 86 if ($menu.hasClass('rtmega-expand-hover-submenu-open-click')) { 87 $menu.mgaccordion({ theme: 'tree' }); 88 } 89 }; 90 $(window).on('load resize', RTMEGhoverExpandClassAdd); 91 } 92 93 94 $(window).on('elementor/frontend/init', function () { 95 elementorFrontend.hooks.addAction('frontend/element_ready/rt-mega-navigation-menu.default', function ($scope) { 96 RTmegaMenu.enableAccordion($scope); 97 RTmegaMenu.enableHeaderScript(); 98 99 // Re-apply vertical menu hover logic if needed 100 const $menu = $scope.find('.rtmega-menu-area .rtmega-megamenu.vertical.vertical-submenu-expand-mode-hover'); 101 if ($menu.length) { 102 const RTMEGhoverExpandClassAdd = () => { 103 $menu.toggleClass('rtmega-expand-hover-submenu-open-click', window.innerWidth <= 1024); 104 if ($menu.hasClass('rtmega-expand-hover-submenu-open-click')) { 105 $menu.mgaccordion({ theme: 'tree' }); 106 } 107 }; 108 RTMEGhoverExpandClassAdd(); 109 $(window).on('resize', RTMEGhoverExpandClassAdd); 110 } 111 }); 112 });
113 114})(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.