PageSourceSearch

https://sandybrown-seahorse-487194.hostingersite.com/wp-content/pl…/js/addons/nav-menu.js?ver=1791003114

js sandybrown-seahorse-487194.hostingersite.com collected 2026-10-03 04:53:46 UTC 14,239 bytes, 358 lines download raw bytes

1( function( $, elementor ) {
2
3    "use strict";
4
5    $( window ).on( 'elementor/frontend/init', function (){
6        elementor.hooks.addAction( 'frontend/element_ready/kitify-nav-menu.default', function ( $scope ){
7            if ( $scope.data( 'initialized' ) ) {
8                return;
9            }
10
11            $scope.data( 'initialized', true );
12
13            var hoverClass        = 'kitify-nav-hover',
14                hoverOutClass     = 'kitify-nav-hover-out',
15                mobileActiveClass = 'kitify-mobile-menu-active',
16                _has_mobile_bkp   = false;
17
18            if($scope.find('.kitify-mobile-menu').length){
19                _has_mobile_bkp = $scope.find('.kitify-mobile-menu').data('mobile-breakpoint');
20            }
21
22            function checkActiveMobileTrigger(){
23                if(_has_mobile_bkp !== false && $(window).width() <= _has_mobile_bkp){
24                    $scope.find('.kitify-mobile-menu').addClass('kitify-active--mbmenu');
25                }
26                else{
27                    $scope.find('.kitify-mobile-menu').removeClass('kitify-active--mbmenu');
28                }
29            }
30            checkActiveMobileTrigger();
31            $(window).on('resize', checkActiveMobileTrigger);
32
33            $scope.find( '.kitify-nav:not(.kitify-nav--vertical-sub-bottom)' ).hoverIntent({
34                over: function() {
35                    $( this ).addClass( hoverClass );
36                },
37                out: function() {
38                    var $this = $( this );
39                    $this.removeClass( hoverClass );
40                    $this.addClass( hoverOutClass );
41                    setTimeout( function() {
42                        $this.removeClass( hoverOutClass );
43                    }, 200 );
44                },
45                timeout: 200,
46                selector: '.menu-item-has-children'
47            });
48
49            if ( Kitify.mobileAndTabletCheck() ) {
50                $scope.find( '.kitify-nav:not(.kitify-nav--vertical-sub-bottom)' ).on( 'touchstart.kitifyNavMenu', '.menu-item > a', touchStartItem );
51                $scope.find( '.kitify-nav:not(.kitify-nav--vertical-sub-bottom)' ).on( 'touchend.kitifyNavMenu', '.menu-item > a', touchEndItem );
52
53                $( document ).on( 'touchstart.kitifyNavMenu', prepareHideSubMenus );
54                $( document ).on( 'touchend.kitifyNavMenu', hideSubMenus );
55            } else {
56                $scope.find( '.kitify-nav:not(.kitify-nav--vertical-sub-bottom)' ).on( 'click.kitifyNavMenu', '.menu-item > a', clickItem );
57            }
58
59            if ( ! Kitify.isEditMode() ) {
60                initMenuAnchorsHandler();
61            }
62
63            function touchStartItem( event ) {
64                var $currentTarget = $( event.currentTarget ),
65                    $this = $currentTarget.closest( '.menu-item' );
66
67                $this.data( 'offset', $( window ).scrollTop() );
68                $this.data( 'elemOffset', $this.offset().top );
69            }
70
71            function touchEndItem( event ) {
72                var $this,
73                    $siblingsItems,
74                    $link,
75                    $currentTarget,
76                    subMenu,
77                    offset,
78                    elemOffset,
79                    $hamburgerPanel;
80
81                event.preventDefault();
82
83                $currentTarget  = $( event.currentTarget );
84                $this           = $currentTarget.closest( '.menu-item' );
85                $siblingsItems  = $this.siblings( '.menu-item.menu-item-has-children' );
86                $link           = $( '> a', $this );
87                subMenu         = $( '.kitify-nav__sub:first', $this );
88                offset          = $this.data( 'offset' );
89                elemOffset      = $this.data( 'elemOffset' );
90                $hamburgerPanel = $this.closest( '.kitify-hamburger-panel' );
91
92                if ( offset !== $( window ).scrollTop() || elemOffset !== $this.offset().top ) {
93                    return false;
94                }
95
96                if ( $siblingsItems[0] ) {
97                    $siblingsItems.removeClass( hoverClass );
98                    $( '.menu-item-has-children', $siblingsItems ).removeClass( hoverClass );
99                }
100
101                if ( ! $( '.kitify-nav__sub', $this )[0] || $this.hasClass( hoverClass ) ) {
102                    $link.trigger( 'click' ); // Need for a smooth scroll when clicking on an anchor link
103                    window.location.href = $link.attr( 'href' );
104
105                    if ( $scope.find( '.kitify-nav-wrap' ).hasClass( mobileActiveClass ) ) {
106                        $scope.find( '.kitify-nav-wrap' ).removeClass( mobileActiveClass );
107                    }
108
109                    if ( $hamburgerPanel[0] && $hamburgerPanel.hasClass( 'open-state' ) ) {
110                        $hamburgerPanel.removeClass( 'open-state' );
111                        $( 'html' ).removeClass( 'kitify-hamburger-panel-visible' );
112                    }
113
114                    return false;
115                }
116
117                if ( subMenu[0] ) {
118                    $this.addClass( hoverClass );
119                }
120            }
121
122            function clickItem( event ) {
123                var $currentTarget  = $( event.currentTarget ),
124                    $menuItem       = $currentTarget.closest( '.menu-item' ),
125                    $hamburgerPanel = $menuItem.closest( '.kitify-hamburger-panel' );
126
127                if ( ! $menuItem.hasClass( 'menu-item-has-children' ) || $menuItem.hasClass( hoverClass ) ) {
128
129                    if ( $hamburgerPanel[0] && $hamburgerPanel.hasClass( 'open-state' ) ) {
130                        $hamburgerPanel.removeClass( 'open-state' );
131                        $( 'html' ).removeClass( 'kitify-hamburger-panel-visible' );
132                    }
133
134                }
135            }
136
137            var scrollOffset;
138
139            function prepareHideSubMenus( event ) {
140                scrollOffset = $( window ).scrollTop();
141            }
142
143            function hideSubMenus( event ) {
144                var $menu = $scope.find( '.kitify-nav' );
145
146                if ( 'touchend' === event.type && scrollOffset !== $( window ).scrollTop() ) {
147                    return;
148                }
149
150                if ( $( event.target ).closest( $menu ).length ) {
151                    return;
152                }
153
154                var $openMenuItems = $( '.menu-item-has-children.' + hoverClass, $menu );
155
156                if ( ! $openMenuItems[0] ) {
157                    return;
158                }
159
160                $openMenuItems.removeClass( hoverClass );
161                $openMenuItems.addClass( hoverOutClass );
162
163                setTimeout( function() {
164                    $openMenuItems.removeClass( hoverOutClass );
165                }, 200 );
166
167                if ( $menu.hasClass( 'kitify-nav--vertical-sub-bottom' ) ) {
168                    $( '.kitify-nav__sub', $openMenuItems ).slideUp( 200 );
169                }
170
171                event.stopPropagation();
172            }
173
174            // START Vertical Layout: Sub-menu at the bottom
175            $scope.find( '.kitify-nav--vertical-sub-bottom' ).on( 'click.kitifyNavMenu', '.menu-item > a', verticalSubBottomHandler );
176
177            function verticalSubBottomHandler( event ) {
178                var $currentTarget  = $( event.currentTarget ),
179                    $menuItem       = $currentTarget.closest( '.menu-item' ),
180                    $siblingsItems  = $menuItem.siblings( '.menu-item.menu-item-has-children' ),
181                    $subMenu        = $( '.kitify-nav__sub:first', $menuItem ),
182                    $hamburgerPanel = $menuItem.closest( '.kitify-hamburger-panel' );
183
184                if ( ! $menuItem.hasClass( 'menu-item-has-children' ) || $menuItem.hasClass( hoverClass ) ) {
185
186                    if ( $scope.find( '.kitify-nav-wrap' ).hasClass( mobileActiveClass ) ) {
187                        $scope.find( '.kitify-nav-wrap' ).removeClass( mobileActiveClass );
188                    }
189
190                    if ( $hamburgerPanel[0] && $hamburgerPanel.hasClass( 'open-state' ) ) {
191                        $hamburgerPanel.removeClass( 'open-state' );
192                        $( 'html' ).removeClass( 'kitify-hamburger-panel-visible' );
193                    }
194
195                    return;
196                }
197
198                event.preventDefault();
199                event.stopPropagation();
200
201                if ( $siblingsItems[0] ) {
202                    $siblingsItems.removeClass( hoverClass );
203                    $( '.menu-item-has-children', $siblingsItems ).removeClass( hoverClass );
204                    $( '.kitify-nav__sub', $siblingsItems ).slideUp( 200 );
205                }
206
207                if ( $subMenu[0] ) {
208                    $subMenu.slideDown( 200 );
209                    $menuItem.addClass( hoverClass );
210                }
211            }
212
213            $( document ).on( 'click.kitifyNavMenu', hideVerticalSubBottomMenus );
214
215            function hideVerticalSubBottomMenus( event ) {
216                if ( ! $scope.find( '.kitify-nav' ).hasClass( 'kitify-nav--vertical-sub-bottom' ) ) {
217                    return;
218                }
219
220                hideSubMenus( event );
221            }
222            // END Vertical Layout: Sub-menu at the bottom
223
224            // Mobile trigger click event
225            $( '.kitify-nav__mobile-trigger', $scope ).on( 'click.kitifyNavMenu', function( event ) {
226                $( this ).closest( '.kitify-nav-wrap' ).toggleClass( mobileActiveClass );
227            } );
228
229            // START Mobile Layout: Left-side, Right-side
230            if ( 'ontouchend' in window ) {
231                $( document ).on( 'touchend.kitifyMobileNavMenu', removeMobileActiveClass );
232            } else {
233                $( document ).on( 'click.kitifyMobileNavMenu', removeMobileActiveClass );
234            }
235
236            function removeMobileActiveClass( event ) {
237                var mobileLayout = $scope.find( '.kitify-nav-wrap' ).data( 'mobile-layout' ),
238                    $navWrap     = $scope.find( '.kitify-nav-wrap' ),
239                    $trigger     = $scope.find( '.kitify-nav__mobile-trigger' ),
240                    $menu        = $scope.find( '.kitify-nav' );
241
242                if ( 'left-side' !== mobileLayout && 'right-side' !== mobileLayout ) {
243                    return;
244                }
245
246                if ( 'touchend' === event.type && scrollOffset !== $( window ).scrollTop() ) {
247                    return;
248                }
249
250                if ( $( event.target ).closest( $trigger ).length || $( event.target ).closest( $menu ).length ) {
251                    return;
252                }
253
254                if ( ! $navWrap.hasClass( mobileActiveClass ) ) {
255                    return;
256                }
257
258                $navWrap.removeClass( mobileActiveClass );
259
260                event.stopPropagation();
261            }
262
263            $( '.kitify-nav__mobile-close-btn', $scope ).on( 'click.kitifyMobileNavMenu', function( event ) {
264                $( this ).closest( '.kitify-nav-wrap' ).removeClass( mobileActiveClass );
265            } );
266
267            // END Mobile Layout: Left-side, Right-side
268
269            // START Mobile Layout: Full-width
270            var initMobileFullWidthCss = false;
271
272            setFullWidthMenuPosition();
273            $( window ).on( 'resize.kitifyMobileNavMenu', setFullWidthMenuPosition );
274
275            function setFullWidthMenuPosition() {
276                var mobileLayout = $scope.find( '.kitify-nav-wrap' ).data( 'mobile-layout' );
277
278                if ( 'full-width' !== mobileLayout ) {
279                    return;
280                }
281
282                var $menu = $scope.find( '.kitify-nav' ),
283                    currentDeviceMode = elementorFrontend.getCurrentDeviceMode();
284
285                if ( 'mobile' !== currentDeviceMode ) {
286                    if ( initMobileFullWidthCss ) {
287                        $menu.css( { 'left': '' } );
288                        initMobileFullWidthCss = false;
289                    }
290                    return;
291                }
292
293                if ( initMobileFullWidthCss ) {
294                    $menu.css( { 'left': '' } );
295                }
296
297                var offset = - $menu.offset().left;
298
299                $menu.css( { 'left': offset } );
300                initMobileFullWidthCss = true;
301            }
302            // END Mobile Layout: Full-width
303
304            // Menu Anchors Handler
305            function initMenuAnchorsHandler() {
306                var $anchorLinks = $scope.find( '.menu-item-link[href*="#"]' );
307
308                if ( $anchorLinks[0] ) {
309                    $anchorLinks.each( function() {
310                        if ( '' !== this.hash && location.pathname === this.pathname ) {
311                            menuAnchorHandler( $( this ) );
312                        }
313                    } );
314                }
315            }
316
317            function menuAnchorHandler( $anchorLink ) {
318                var anchorHash = $anchorLink[0].hash,
319                    activeClass = 'current-menu-item',
320                    rootMargin = '-50% 0% -50%',
321                    $anchor;
322
323                try {
324                    $anchor = $( decodeURIComponent( anchorHash ) );
325                } catch (e) {
326                    return;
327                }
328
329                if ( !$anchor[0] ) {
330                    return;
331                }
332
333                if ( $anchor.hasClass( 'elementor-menu-anchor' ) ) {
334                    rootMargin = '300px 0% -300px';
335                }
336
337                var observer = new IntersectionObserver( function( entries ) {
338                        if ( entries[0].isIntersecting ) {
339                            $anchorLink.parent( '.menu-item' ).addClass( activeClass );
340                        } else {
341                            $anchorLink.parent( '.menu-item' ).removeClass( activeClass );
342                        }
343                    },
344                    {
345                        rootMargin: rootMargin
346                    }
347                );
348
349                observer.observe( $anchor[0] );
350            }
351
352            if ( Kitify.isEditMode() ) {
353                $scope.data( 'initialized', false );
354            }
355        } );
356    } );
357
358}( jQuery, window.elementorFrontend ) );

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.