PageSourceSearch

https://www.goodadvicebooks.nl/wp-content/themes/gridnext/assets/js/custom.js

js goodadvicebooks.nl collected 2026-09-27 10:25:52 UTC 7,635 bytes, 182 lines download raw bytes

1jQuery(document).ready(function($) {
2    'use strict';
3
4    if(gridnext_ajax_object.secondary_menu_active){
5
6        $(".gridnext-nav-secondary .gridnext-secondary-nav-menu").addClass("gridnext-secondary-responsive-menu");
7
8        $( ".gridnext-secondary-responsive-menu-icon" ).on( "click", function() {
9            $(this).next(".gridnext-nav-secondary .gridnext-secondary-nav-menu").slideToggle();
10        });
11
12        $(window).on( "resize", function() {
13            if(window.innerWidth > 1112) {
14                $(".gridnext-nav-secondary .gridnext-secondary-nav-menu, nav .sub-menu, nav .children").removeAttr("style");
15                $(".gridnext-secondary-responsive-menu > li").removeClass("gridnext-secondary-menu-open");
16            }
17        });
18
19        $( ".gridnext-secondary-responsive-menu > li" ).on( "click", function(event) {
20            if (event.target !== this)
21            return;
22            $(this).find(".sub-menu:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-secondary-menu-open");
23            $(this).find(".children:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-secondary-menu-open");
24        });
25
26        $( "div.gridnext-secondary-responsive-menu > ul > li" ).on( "click", function(event) {
27            if (event.target !== this)
28                return;
29            $(this).find("ul:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-secondary-menu-open");
30        });
31
32    }
33
34    if(gridnext_ajax_object.primary_menu_active){
35
36        $(".gridnext-nav-primary .gridnext-primary-nav-menu").addClass("gridnext-primary-responsive-menu");
37
38        $( ".gridnext-primary-responsive-menu-icon" ).on( "click", function() {
39            $(this).next(".gridnext-nav-primary .gridnext-primary-nav-menu").slideToggle();
40        });
41
42        $(window).on( "resize", function() {
43            if(window.innerWidth > 1112) {
44                $(".gridnext-nav-primary .gridnext-primary-nav-menu, nav .sub-menu, nav .children").removeAttr("style");
45                $(".gridnext-primary-responsive-menu > li").removeClass("gridnext-primary-menu-open");
46            }
47        });
48
49        $( ".gridnext-primary-responsive-menu > li" ).on( "click", function(event) {
50            if (event.target !== this)
51            return;
52            $(this).find(".sub-menu:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-primary-menu-open");
53            $(this).find(".children:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-primary-menu-open");
54        });
55
56        $( "div.gridnext-primary-responsive-menu > ul > li" ).on( "click", function(event) {
57            if (event.target !== this)
58                return;
59            $(this).find("ul:first").toggleClass('gridnext-submenu-toggle').parent().toggleClass("gridnext-primary-menu-open");
60        });
61
62    }
63
64    if($(".gridnext-sidebar-one-wrapper").length){
65    $(".gridnext-main-wrapper").before($(".gridnext-sidebar-one-wrapper"));
66    $(window).on( "resize", function() {
67        if(window.innerWidth > 960) {
68            $(".gridnext-main-wrapper").before($(".gridnext-sidebar-one-wrapper"));
69        } else {
70            $(".gridnext-main-wrapper").after($(".gridnext-sidebar-one-wrapper"));
71        }
72    });
73    }
74
75    if($(".gridnext-header-social-icon-search").length){
76        $(".gridnext-header-social-icon-search").on('click', function (e) {
77            e.preventDefault();
78            //document.getElementById("gridnext-search-overlay-wrap").style.display = "block";
79            $("#gridnext-search-overlay-wrap").fadeIn();
80            const gridnext_focusableelements = 'button, [href], input';
81            const gridnext_search_modal = document.querySelector('#gridnext-search-overlay-wrap');
82            const gridnext_firstfocusableelement = gridnext_search_modal.querySelectorAll(gridnext_focusableelements)[0];
83            const gridnext_focusablecontent = gridnext_search_modal.querySelectorAll(gridnext_focusableelements);
84            const gridnext_lastfocusableelement = gridnext_focusablecontent[gridnext_focusablecontent.length - 1];
85            document.addEventListener('keydown', function(e) {
86              let isTabPressed = e.key === 'Tab' || e.keyCode === 9;
87              if (!isTabPressed) {
88                return;
89              }
90              if (e.shiftKey) {
91                if (document.activeElement === gridnext_firstfocusableelement) {
92                  gridnext_lastfocusableelement.focus();
93                  e.preventDefault();
94                }
95              } else {
96                if (document.activeElement === gridnext_lastfocusableelement) {
97                  gridnext_firstfocusableelement.focus();
98                  e.preventDefault();
99                }
100              }
101            });
102            gridnext_firstfocusableelement.focus();
103        });
104    }
105
106    if($(".gridnext-search-closebtn").length){
107        $(".gridnext-search-closebtn").on('click', function (e) {
108            e.preventDefault();
109            //document.getElementById("gridnext-search-overlay-wrap").style.display = "none";
110            $("#gridnext-search-overlay-wrap").fadeOut();
111        });
112    }
113
114    if(gridnext_ajax_object.fitvids_active){
115        $(".entry-content, .widget").fitVids();
116    }
117
118    if($(".gridnext-scroll-top").length){
119        var gridnext_scroll_button = $( '.gridnext-scroll-top' );
120        gridnext_scroll_button.hide();
121
122        $( window ).on( "scroll", function() {
123            if ( $( window ).scrollTop() < 20 ) {
124                $( '.gridnext-scroll-top' ).fadeOut();
125            } else {
126                $( '.gridnext-scroll-top' ).fadeIn();
127            }
128        } );
129
130        gridnext_scroll_button.on( "click", function() {
131            $( "html, body" ).animate( { scrollTop: 0 }, 300 );
132            return false;
133        } );
134    }
135
136    if(gridnext_ajax_object.sticky_header_active){
137
138    // grab the initial top offset of the navigation 
139    var gridnextstickyheadertop = $('#gridnext-header-end').offset().top;
140    
141    // our function that decides weather the navigation bar should have "fixed" css position or not.
142    var gridnextstickyheader = function(){
143        var gridnextscrolltop = $(window).scrollTop(); // our current vertical position from the top
144             
145        // if we've scrolled more than the navigation, change its position to fixed to stick to top,
146        // otherwise change it back to relative
147        if(window.innerWidth > 1112) {
148            if (gridnextscrolltop > gridnextstickyheadertop) {
149                $('.gridnext-site-header').addClass('gridnext-fixed');
150            } else {
151                $('.gridnext-site-header').removeClass('gridnext-fixed');
152            }
153        }
154    };
155
156    gridnextstickyheader();
157    // and run it again every time you scroll
158    $(window).on( "scroll", function() {
159        gridnextstickyheader();
160    });
161
162    }
163
164    if(gridnext_ajax_object.sticky_sidebar_active){
165        $('.gridnext-main-wrapper, .gridnext-sidebar-one-wrapper').theiaStickySidebar({
166            containerSelector: ".gridnext-content-wrapper",
167            additionalMarginTop: 0,
168            additionalMarginBottom: 0,
169            minWidth: 960,
170        });
171
172        $(window).on( "resize", function() {
173            $('.gridnext-main-wrapper, .gridnext-sidebar-one-wrapper').theiaStickySidebar({
174                containerSelector: ".gridnext-content-wrapper",
175                additionalMarginTop: 0,
176                additionalMarginBottom: 0,
177                minWidth: 960,
178            });
179        });
180    }
181
182});

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.