PageSourceSearch

https://rascalpowermobility.com/js/nav-menu.js

js rascalpowermobility.com collected 2026-10-09 23:34:51 UTC 4,331 bytes, 109 lines download raw bytes

1/*-----------------------------------------------------------------------------------
2
3    Theme Name: Crizal - Multipurpose Responsive Template + Admin
4    Description: Multipurpose Website Template + Admin
5    Author: Chitrakoot Web
6    Version: 4.0
7
8    ---------------------------------- */
9    
10(function ($) {
11    "use strict";
12    $.fn.menumaker = function (options) {
13
14        var nav = $(this),
15
16            settings = $.extend({
17                format: "dropdown",
18                sticky: false
19            }, options);
20
21        return this.each(function () {
22
23            $(this).find(".navbar-toggler").on('click', function () {
24                $(this).toggleClass('menu-opened');
25                var mainmenu = $(this).next('ul');
26                if (mainmenu.hasClass('open')) {
27                    mainmenu.slideToggle().removeClass('open');
28                } else {
29                    mainmenu.slideToggle().addClass('open');
30                    if (settings.format === "dropdown") {
31                        mainmenu.find('ul').show();
32                    }
33                }
34            });
35
36            nav.find('.navbar-nav li ul').parent().addClass('has-sub');
37            nav.find('.navbar-nav li ul li').parent().addClass('sub-menu');
38            var multiTg = function () {
39
40                // For First Level
41                nav.find(".has-sub").prepend('<span class="submenu-button"></span>');
42                nav.find('.navbar-nav > li.has-sub > .submenu-button').on('click', function () {
43                    $(this).next('.sub-menu').slideToggle();
44                    $(this).siblings('ul').addClass('open').slideToggle();
45                    $(this).parents('.navbar-nav > li.has-sub').toggleClass('active').siblings('.has-sub').children('.sub-menu').slideUp().removeClass('open').parents('li').removeClass('active');
46                });
47
48                // For Second Level
49                nav.find('.sub-menu > li.has-sub > .submenu-button').on('click', function () {
50                    $(this).next('.sub-menu').slideToggle();
51                    $(this).siblings('ul').addClass('open').slideToggle();
52                    $(this).parents('.sub-menu > li').toggleClass('active').siblings('.has-sub').children('.sub-menu').slideUp().removeClass('open').parents('li').removeClass('active');
53                    if ($(this).siblings('ul').hasClass('open')) {
54                        $(this).parents('li').eq(1).addClass('active');
55                    }
56                });
57
58            };
59
60            if (settings.format === 'multitoggle') multiTg();
61            else nav.addClass('dropdown');
62            if (settings.sticky === true) nav.css('position', 'fixed');
63            var resizeFix = function () {
64                var mediasize = 991;
65                if ($(window).width() > mediasize) {
66                    nav.find('ul').show();
67                }
68            };
69
70            resizeFix();
71            return $(window).on('resize', resizeFix);
72
73        });
74    };
75
76    $(document).ready(function () {
77
78        $("nav").menumaker({
79            format: "multitoggle"
80        });
81
82        /*------------------------------------
83            Menu Selector
84        --------------------------------------*/
85
86        var urlparam = window.location.pathname.split('/');
87        var menuselctor = window.location.pathname;
88        if (urlparam[urlparam.length - 1].length > 0) menuselctor = urlparam[urlparam.length - 1];
89        else menuselctor = urlparam[urlparam.length - 2];
90        $('.navbar-nav li').find('a[href="' + menuselctor + '"]').closest('li').addClass('active').parents().eq(1).addClass('current');
91        $('.navbar-nav li.has-sub ul li').find('a[href="' + menuselctor + '"]').parents().eq(4).addClass('current');
92    });
93
94    /*------------------------------------
95            Toggle Search
96    --------------------------------------*/
97
98    $(".navbar-default .attr-nav").each(function () {
99        $("li.search > a", this).on("click", function (e) {
100            e.preventDefault();
101            $(".top-search").slideToggle();
102        });
103    });
104
105    $(".input-group-addon.close-search").on("click", function () {
106        $(".top-search").slideUp();
107    });
108
109})(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.