PageSourceSearch

https://macinchem.org/wp-content/themes/fairy/candidthemes/assets/custom/js/custom.js?ver=1.4.2

js macinchem.org collected 2026-10-02 05:57:47 UTC 7,404 bytes, 221 lines download raw bytes

1jQuery(document).ready(function($){
2    if ( jQuery('.top-header-toggle-btn').length > 0 ) {
3        $('.top-header-toggle-btn').on('click', function (e) {
4            e.preventDefault();
5            $('.site-header-topbar .container').toggle('slow');
6            $('.top-header-toggle-btn i').toggleClass('ct-rotate');
7        });
8    }
9    if ($('.hero_slick-slider').length > 0) {
10        $('.hero_slick-slider').slick({
11            items: 1,
12            dots: false,
13            infinite: true,
14            centerMode: false,
15            autoplay: true,
16            lazyLoad: 'ondemand',
17            adaptiveHeight: true
18        });
19    }
20
21   /*
22    ** ### Back to top function for guide section in detail page
23    */ 
24
25	if ($('.go-to-top').length) {
26      var scrollTrigger = $('body').position(); // px
27          goToTop = function () {
28			  
29      var scrollTop = $(window).scrollTop();
30              if (scrollTop > 150) {
31                  $('.footer-go-to-top').addClass('show');
32              } else {
33                  $('.footer-go-to-top').removeClass('show');
34              }
35          };
36      goToTop();
37      $(window).on('scroll', function () {
38          goToTop();
39      });
40      $('.go-to-top').on('click', function (e) {
41          e.preventDefault();
42          $('html,body').animate({
43              scrollTop: scrollTrigger.top
44          }, 700);
45      });
46    }
47
48    /*** 
49     * STICKY HEADER SCRIPT
50    */
51
52    var headerArea_header = $('.site-header');
53
54    function stickyHeaderOnScroll() {
55        var scrollTopPosition = $(window).scrollTop();
56        if (scrollTopPosition > 40) {
57            headerArea_header.addClass('sticky-header');
58        }
59        else {
60            headerArea_header.removeClass('sticky-header');
61        }
62    }
63
64    if (headerArea_header) {
65        $(window).on('scroll', function () {
66            stickyHeaderOnScroll();
67        })
68    }
69
70
71    /****
72     * Mobile Dropdown Menu Script
73     */
74
75    var menuPrimary_ul = $('#primary-menu'),
76        parrentLink_li = $('#primary-menu > .menu-item-has-children'),
77        secondLink_li = $('#primary-menu > .menu-item-has-children .menu-item-has-children'),
78        subMenu_ul = $('#primary-menu > li  > .sub-menu'),
79        secSubMenu_ul = $('#primary-menu .sub-menu .sub-menu'),
80        MenuToggleBtn_button = $('#masthead .menu-toggle');
81
82    function addMobileAccessBtn() {
83        parrentLink_li.append('<span class="for-sub-menu"></span>');
84        secondLink_li.append('<span class="sec-sub-menu"></span>');
85    }
86
87    function mobileMenuEasyDropDown() {
88        addMobileAccessBtn();
89
90        var subMenuBtn_span = $('.for-sub-menu');
91        var secSubMenuBtn_span = $('.sec-sub-menu');
92
93        subMenuBtn_span.click(function() {
94            $(this).siblings(subMenu_ul).toggleClass('open');
95        })
96
97        secSubMenuBtn_span.click(function() {
98            $(this).siblings(secSubMenu_ul).toggleClass('sec-open');
99        })
100
101
102
103
104    }
105
106    function offCanvaMenu() {
107        jQuery('.main-navigation').addClass('toggled');
108        menuPrimary_ul.addClass('off_canva_nav');
109        $('#primary-menu > li:first-child').addClass('focus');
110        $('#primary-menu > li:first-child a').focus();
111
112
113    }
114
115    var width = $(window).width();
116    if(width < 992) {
117        $('.main-navigation').on('keydown', function(e) {
118            if($('.main-navigation').hasClass('toggled')) {
119                var focusableEls = $('.main-navigation a[href]:not([disabled]), .main-navigation button');
120                var firstFocusableEl = focusableEls[0];
121                var lastFocusableEl = focusableEls[focusableEls.length - 1];
122                var KEYCODE_TAB = 9;
123                if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) {
124                    if ( e.shiftKey ) /* shift + tab */ {
125                        if (document.activeElement === firstFocusableEl) {
126                            lastFocusableEl.focus();
127                            e.preventDefault();
128                        }
129                    }
130                    else /* tab */ {
131                        if (document.activeElement === lastFocusableEl) {
132                            firstFocusableEl.focus();
133                            e.preventDefault();
134                        }
135                    }
136                }
137            }
138        });
139    }
140
141    MenuToggleBtn_button.click(function() {
142        offCanvaMenu();
143
144        jQuery('#primary-menu .close_nav').click(function() {
145
146            jQuery('.main-navigation').removeClass('toggled');
147            menuPrimary_ul.removeClass('off_canva_nav');
148            $('.menu-toggle').focus();
149        })
150    })
151
152    mobileMenuEasyDropDown();
153
154
155    /****
156     * Search Dialoge JS
157     */
158    if ($('.search-section').length) {
159        var searchDialoge_section = $('.site > .search-section'),
160            searchToggle_button = $('.search-toggle'),
161            searchField_input = $('.site > .search-section .search-field'),
162            searchClose_button = $('.close-btn');
163
164        searchToggle_button.click(function () {
165            searchDialoge_section.toggleClass('ct-search-access');
166            setTimeout(function () {
167                searchField_input.focus();
168            }, 100)
169
170            $('.site > .search-section').on('keydown', function (e) {
171                if ($('.site > .search-section').hasClass('ct-search-access')) {
172                    var focusableEls = $(' .site > .search-section .close-btn, .site > .search-section .search-field, .site > .search-section .search-submit');
173                    var firstFocusableEl = focusableEls[0];
174                    var lastFocusableEl = focusableEls[focusableEls.length - 1];
175                    var KEYCODE_TAB = 9;
176                    if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) {
177                        if (e.shiftKey) /* shift + tab */ {
178                            if (document.activeElement === firstFocusableEl) {
179                                lastFocusableEl.focus();
180                                e.preventDefault();
181                            }
182                        } else /* tab */ {
183                            if (document.activeElement === lastFocusableEl) {
184                                firstFocusableEl.focus();
185                                e.preventDefault();
186                            }
187                        }
188                    }
189                }
190            });
191
192            searchClose_button.click(function () {
193                searchDialoge_section.removeClass('ct-search-access');
194            });
195        });
196
197    }
198
199    //sticky sidebar
200    var at_body = $("body");
201    var at_window = $(window);
202
203    if(at_body.hasClass('ct-sticky-sidebar')){
204            $('#secondary, #primary').theiaStickySidebar();
205
206    }
207
208 });
209jQuery(window).load(function($) {
210    if ( jQuery('.fairy-masonry').length > 0 ) {
211        var $container = jQuery('.fairy-masonry');
212        // initialize
213        $container.masonry({
214            itemSelector: '.fairy-masonry article.post, .fairy-masonry article.page',
215            columnWidth: '.fairy-masonry article.post, .fairy-masonry article.page',
216            percentPosition: true
217        });
218    }
219});
220
221 

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.