PageSourceSearch

https://mevren.ai/wp-content/themes/ainus/assets/js/menu.js?ver=1.0.1

js mevren.ai collected 2026-10-05 13:37:06 UTC 4,833 bytes, 120 lines download raw bytes

1
2;(function ($) {
3    "use strict";
4    let windowWidth = $(window).width();
5    let windowHeight = $(window).height();
6    let lastScrollTop  = 150;
7
8    $(window).on('load', function () {
9        windowWidth = $(window).width();
10        windowHeight = $(window).height();
11    });
12
13    $(window).on('resize', function () {
14        windowWidth = $(window).width();
15        windowHeight = $(window).height();
16    });
17
18    $(document).ready(function () { 
19        ainusToggleMobileMenu();
20        setTimeout(function(){
21            ainusHandleSubmenu();
22            activeMenuToSubmenu()
23        }, 150)
24        handleMenuPanel();
25    });
26    $(window).on('scroll', function () {
27        let scrollTop = $(this).scrollTop();
28        if (scrollTop > 150 && windowWidth >= 1200) {
29            if (scrollTop > lastScrollTop) {
30                $('.pxl-header-sticky.scroll-down').css('transform', 'translateY(0)');
31                $('.pxl-header-sticky.scroll-up').css('transform', 'translateY(-100%)');
32            } else {
33                $('.pxl-header-sticky.scroll-up').css('transform', 'translateY(0)');
34                $('.pxl-header-sticky.scroll-down').css('transform', 'translateY(-100%)');
35            }
36        } 
37        else if (scrollTop < 100 && windowWidth >= 1200) {
38            $('.pxl-header-sticky.scroll-up').css('transform', 'translateY(-100%)');
39        }
40        lastScrollTop = scrollTop <= 0 ? 0 : scrollTop;
41    });
42
43    // Toggle Mobile Menu
44    function ainusToggleMobileMenu() {
45        $('.pxl-toggle-menu').on('click', function(e) {
46            e.preventDefault();
47            $(this).siblings('.pxl-sidebar-menu').toggleClass('active');
48            $(this).siblings('.pxl-header-backdrop').toggleClass('active');
49            $('body').addClass('body-overflow');
50        })
51
52        $('.pxl-header-backdrop').on('click', function(e) {
53            $(this).siblings('.pxl-sidebar-menu').toggleClass('active');
54            $(this).toggleClass('active')
55            $('body').removeClass('body-overflow');
56        })
57
58        $('.pxl-header .pxl-close-menu').on('click', function () {  
59            $(this).closest('.pxl-sidebar-menu').toggleClass('active');
60            $('body').removeClass('body-overflow');
61            $('.pxl-header .pxl-header-backdrop').toggleClass('active')
62        }) 
63        
64    }
65    // Menu Responsive Dropdown 
66    function ainusHandleSubmenu() {
67        const menu_items = $('.pxl-header li.menu-item-has-children');
68        if(!menu_items.length) return;
69        menu_items.each(function (i, menu_item) {
70            let submenu = $(menu_item).find('> .sub-menu').first();
71            const menuLink = $(menu_item).find('> a');
72            if(windowWidth < 1200) {
73                $(menuLink).append('<span class="menu-icon-toggle"></span>')
74            }
75            if (!submenu.length) return;
76            if( (submenu.offset().left + submenu.width() + 0 ) > $(window).width() )
77                submenu.addClass('submenu-reverse');
78            $(menuLink).on('click', function (e) {
79                if (windowWidth >= 1200) return;
80                e.preventDefault();
81                e.stopPropagation(); 
82                $(submenu).toggleClass('active').slideToggle(500);
83            });
84        });
85    }
86
87    function handleMenuPanel() {
88        const menu_items = $('.menu-panel li.menu-item-has-children');
89        if(!menu_items.length) return;
90        menu_items.each(function (i, menu_item) {
91            let submenu = $(menu_item).find('> .sub-menu').first();
92            const menuLink = $(menu_item).find('> a');
93            if (!submenu.length) return;
94            $(menuLink).on('click', function (e) {
95                e.preventDefault();
96                e.stopPropagation(); 
97                $(submenu).toggleClass('active').slideToggle(750);
98            });
99        });
100    }
101    // Active menu to submenu
102    function activeMenuToSubmenu() {
103        let currentUrl = window.location.href;
104        let megaMenuItems = $('.pxl-menu-primary .sub-menu.pxl-mega-menu');
105        if(!megaMenuItems.length) return;
106        megaMenuItems.each(function (i, menuItem) {
107            const megaMenuItemLinks = $(menuItem).find('a');
108            const currentMenuItem = $(this);
109            if(!megaMenuItemLinks.length) return;
110            megaMenuItemLinks.each(function (i, menuItemLink) {
111                let menuItemLinkHref = String($(menuItemLink).attr('href') + '/');
112                let currentUrlString = String(currentUrl);  
113                if (menuItemLinkHref === currentUrlString) {
114                    $(currentMenuItem).parent('.pxl-megamenu').first().addClass('active');
115                }
116            })
117        });
118    }
119
120})(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.