PageSourceSearch

https://omrt.org/wp-content/themes/appointment/js/menu/menu.js?ver=7.0.6

js omrt.org collected 2026-10-04 02:03:14 UTC 7,228 bytes, 147 lines download raw bytes

1/*Menu Dropdown Onhover Js*/
2jQuery(document).ready(function() {
3
4        /* ---------------------------------------------- /*
5         * Initialization General Scripts for all pages
6         /* ---------------------------------------------- */
7
8        var navbar      = jQuery('.navbar-default'),
9            navHeight   = navbar.height(),
10           // worksgrid   = jQuery('#works-grid'),
11            width       = Math.max(jQuery(window).width(), window.innerWidth),
12            mobileTest  = false;
13
14        if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
15            mobileTest = true;
16        }
17        appointment_navbarSubmenu(width);
18        appointment_hoverDropdown(width, mobileTest);
19
20        jQuery(window).resize(function() {
21            var width = Math.max(jQuery(window).width(), window.innerWidth);
22            appointment_hoverDropdown(width, mobileTest);
23        });
24
25        /* ---------------------------------------------- /*
26         * Navbar submenu
27         /* ---------------------------------------------- */
28
29        function appointment_navbarSubmenu(width) {
30            if (width > 1100) {
31                jQuery('.navbar-default .navbar-nav > li.dropdown').hover(function() {
32                    var MenuLeftOffset  = jQuery(this).offset().left;
33                    var Menu1LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width();
34                    if (width - MenuLeftOffset < Menu1LevelWidth * 2) {
35                        jQuery(this).children('.dropdown-menu').addClass('leftauto');
36                    } else {
37                        jQuery(this).children('.dropdown-menu').removeClass('leftauto');
38                    }
39                    if (jQuery('.dropdown', jQuery(this)).length > 0) {
40                        var Menu2LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width();
41                        if (width - MenuLeftOffset - Menu1LevelWidth < Menu2LevelWidth) {
42                            jQuery(this).children('.dropdown-menu').addClass('left-side');
43                        } else {
44                            jQuery(this).children('.dropdown-menu').removeClass('left-side');
45                        }
46                    }
47                });
48
49                 jQuery('.navbar-default .navbar-nav > li.dropdown a').focus(function() {
50                    var MenuLeftOffsets  = jQuery(this).parent().offset().left;
51                    var Menu1LevelWidth = jQuery('.dropdown-menu', jQuery(this).parent()).width();
52                    if (width - MenuLeftOffsets < Menu1LevelWidth * 2) {
53                        jQuery(this).parent().children('.dropdown-menu').addClass('leftauto');
54                    } else {
55                        jQuery(this).parent().children('.dropdown-menu').removeClass('leftauto');
56                    }
57                    if (jQuery('.dropdown', jQuery(this).parent()).length > 0) {
58                        var Menu2LevelWidth = jQuery('.dropdown-menu', jQuery(this).parent()).width();
59                        if (width - MenuLeftOffsets - Menu1LevelWidth < Menu2LevelWidth) {
60                            jQuery(this).parent().children('.dropdown-menu').addClass('left-side');
61                        } else {
62                            jQuery(this).parent().children('.dropdown-menu').removeClass('left-side');
63                        }
64                    }
65                });
66            }
67        }
68
69        /* ---------------------------------------------- /*
70         * Navbar hover dropdown on desctop
71         /* ---------------------------------------------- */
72
73        function appointment_hoverDropdown(width, mobileTest) {
74            if ((width > 1100) && (mobileTest !== true)) {
75                jQuery('.dropdown-menu').removeAttr("style");
76                var delay = 0;
77                var setTimeoutConst;
78                jQuery('.navbar-default .navbar-nav > li.dropdown, .navbar-default li.dropdown > .dropdown-menu li.dropdown-submenu').hover(function() {
79                        var jQuerythis = jQuery(this);
80                        setTimeoutConst = setTimeout(function() {
81                            jQuerythis.addClass('open');
82                            jQuerythis.find('.dropdown-toggle').addClass('disabled');
83                        }, delay);
84                    },
85                    function() {
86                        clearTimeout(setTimeoutConst);
87                        jQuery(this).removeClass('open');
88                        jQuery(this).find('.dropdown-toggle').removeClass('disabled');
89                    });
90            } else {
91                jQuery('.navbar-default .navbar-nav > li.dropdown, .navbar-default li.dropdown > .dropdown-menu li.dropdown-submenu').unbind('mouseenter mouseleave');
92                jQuery('.navbar-default [data-toggle=dropdown]').not('.binded').addClass('binded').on('click', function(event) {
93                    event.preventDefault();
94                    event.stopPropagation();
95                    jQuery(this).parent().siblings().removeClass('open');
96                    jQuery(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open');
97                    jQuery(this).parent().toggleClass();
98                });
99            }
100        }
101
102          /* ---------------------------------------------- /*
103         * Navbar focus dropdown on desktop
104         /* ---------------------------------------------- */
105
106     const topLevelLinks = Array.prototype.slice.call(document.querySelectorAll(".navbar-default .navbar-nav > li.dropdown a"), 0);
107          topLevelLinks.forEach(function(link){
108             return link.addEventListener('focus', function(e) {
109                this.parentElement.classList.add('open')
110                e.preventDefault();
111                var div_list = e.target.parentElement.querySelectorAll( ".open" );
112                var div_array = Array.prototype.slice.call(div_list);
113                  div_array.forEach(function(e){
114                   return e.classList.remove( "open" )
115                });
116              })             
117
118            })
119
120            jQuery('li a').focus(function() { 
121
122             jQuery(this).parent().siblings().removeClass('open');
123
124            });
125
126           jQuery('a,input').bind('focus', function() {
127             if(!jQuery(this).closest(".menu-item").length ) {
128                topLevelLinks.forEach(function(link){
129                return link.parentElement.classList.remove('open')
130            })
131            }
132        })
133        
134        jQuery('li.dropdown').find('.caret').each(function(){
135            jQuery(this).on('click', function(){
136                if( jQuery(window).width() <= 1100) {
137                  jQuery('li.dropdown,li.dropdown-submenu').removeClass('open');
138                  jQuery(this).parent().next().slideToggle();
139                }
140             return false;
141            });
142        });
143        jQuery('a,input').bind('focus', function() {
144             if(!jQuery(this).closest(".menu-item").length && !jQuery(this).closest(".head-contact-social").length  && ( jQuery(window).width() <= 1100) ) {
145                jQuery('.navbar-collapse').removeClass('in');
146             }})
147});

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.