PageSourceSearch

https://hireinfluence.com/wp-content/themes/Hireinfluence/js/custom.js

js hireinfluence.com collected 2026-09-25 18:50:51 UTC 11,884 bytes, 270 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function(){
2   
3    const heinghtOneLi = document.querySelector('header nav li a').clientHeight;
4    const HeightMobileMenuOpen = document.querySelector('header .fixing nav').scrollHeight;
5
6    /* prevent empty space in pages4
7    function PEPFU(){
8        const bodyElement = document.querySelector('body');
9        var adminHeiht = 0;
10        bodyElement.classList.contains('admin-bar') ? adminHeiht = document.getElementById('wpadminbar').offsetHeight : adminHeiht = 0;
11        var pepFU = window.innerHeight - document.querySelector('footer').offsetHeight - adminHeiht;
12        document.querySelector('body > .content').style.minHeight = pepFU+'px';
13        if(window.innerWidth < 1199){
14            var formHei = window.innerHeight - document.querySelector('header .fixing').clientHeight - adminHeiht;
15            document.querySelector('header nav').style.maxHeight = formHei+'px';
16        } else {
17            document.querySelector('header nav').removeAttribute('style');
18            document.querySelector('header .mobileMenu').classList.remove('mobileMenuOpen');
19            document.querySelector('header nav').classList.remove('open')
20        }
21    }
22    PEPFU();*/
23
24    // Header JS
25    function HH(){
26        var heiHeader = document.querySelector('.fixing').offsetHeight;
27        document.querySelector('header').style.height = heiHeader+'px';
28    }
29    HH();
30    // open mobile menu
31    var navToggle = document.querySelector('header nav');
32    var mobileMenu = document.querySelector('header .mobileMenu');
33    mobileMenu.addEventListener("click", function(e) {
34        var navToggleClose = document.querySelector('.mobileMenu');
35        navToggleClose.classList.contains('mobileMenuOpen') ? navToggleClose.classList.remove('mobileMenuOpen') : navToggleClose.classList.add('mobileMenuOpen');
36        var navToggle = document.querySelector('header nav');
37        if(navToggle.classList.contains('open')) {            
38            navToggle.classList.remove('open');
39            document.querySelector('body').style.overflow=""; 
40            navToggle.style.height = document.querySelector('header nav').style.height = '0px';
41        }  else {
42            document.querySelector('body').style.overflow="hidden"
43            navToggle.classList.add('open');
44            navToggle.style.height = 100+'%';
45        }
46    });
47
48    // add caret to dropdown menu
49    function addArrows() {
50        var childrenLIDesktop = document.querySelectorAll('nav .menu-item-has-children > a');
51        var childrenLIMobile = document.querySelectorAll('nav .menu-item-has-children');
52        const svgArrow = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg>`;
53
54        childrenLIDesktop.forEach(function (e) {
55            let p = document.createElement('span');
56            p.className = "caret";
57            e.appendChild(p);
58        })
59        childrenLIMobile.forEach(function (e) {
60            let p = document.createElement('span');
61            p.innerHTML = svgArrow;
62            p.className = "thereCaret";
63            e.appendChild(p);
64
65        })
66    }
67    addArrows();
68
69    // open on hover or click
70    function headerMenu() {
71        if (window.innerWidth > 1199) {
72            //hover menu
73            [].forEach.call(document.querySelectorAll('header nav ul li'), function (link) {
74                link.addEventListener('mouseover', hoverInSubMenu);
75                link.addEventListener('mouseout', hoverOutSubMenu);
76            });
77            function hoverInSubMenu() {
78                if (this.classList.contains('menu-item-has-children')) {
79                    // var heigthOnHover = this.children[1].getAttribute('sub-menu-height');
80                    // this.children[1].style.height = heigthOnHover+'px';
81                    this.children[1].classList.add('active')
82                }
83            }
84            function hoverOutSubMenu() {
85                var subMenu = document.querySelectorAll('header li .sub-menu');
86                subMenu.forEach(function(e) {
87                    // e.style.height = 0+'px';
88                    e.classList.remove('active')
89                })
90            }
91
92            //hover sub sub menu
93            [].forEach.call(document.querySelectorAll('header nav ul .sub-menu li'), function (link) {
94                link.addEventListener('mouseover', hoverInSubSubMenu);
95                link.addEventListener('mouseout', hoverOutSubSubMenu);
96            });
97            function hoverInSubSubMenu() {
98                if (this.classList.contains('menu-item-has-children')) {
99                    this.parentNode.classList.add('hidden-overflow');
100                }
101
102            }
103            function hoverOutSubSubMenu() {
104                if (this.classList.contains('menu-item-has-children')) {
105                    this.parentNode.classList.remove('hidden-overflow');
106                }
107            }
108            // end hover menu
109        }else{
110            // Open Sub Menu MOBILE
111            function openSubMenus() {
112                var addClassForSubSubMenu = document.querySelectorAll('header .sub-menu .thereCaret');
113                addClassForSubSubMenu.forEach(function(e) {
114                    e.classList.add('thereCaretSecond');
115                })
116                var navbarHeight = document.querySelector('header nav').scrollHeight;
117                if(this.classList.contains('active'))  {
118                    this.classList.remove('active')
119                    document.querySelector('header nav').style.height = navbarHeight - this.parentNode.children[1].scrollHeight+'px';
120                    this.parentNode.children[1].style.height = '0'+'px';
121                    var subMenuLi = this.parentNode.children[1].children;
122                    for (var i = 0; i < subMenuLi.length; i++) {
123                        if (subMenuLi[i].classList.contains('menu-item-has-children')) {
124                            subMenuLi[i].children[1].style.height = 0+'px';
125                            subMenuLi[i].children[2].classList.remove('active');
126                        }
127                    }
128                } else{
129                    this.classList.add('active');
130                    document.querySelector('header nav').style.height = navbarHeight + this.parentNode.children[1].scrollHeight+'px';
131                    this.parentNode.children[1].style.height = this.parentNode.children[1].getAttribute('sub-menu-height')+'px';
132                }
133
134                //open sub sub menu
135                if (this.parentNode.parentNode.hasAttribute('sub-menu-height')) {
136                    this.parentNode.parentNode.classList.add('open-sub-sub-menu');
137                    var heightSubMenuOpen = this.parentNode.parentNode.parentNode.clientHeight;
138                    var heightSubSubMenuOpen = this.parentNode.clientHeight;
139                    this.parentNode.parentNode.style.height = heightSubMenuOpen + +this.parentNode.children[1].getAttribute('sub-menu-height') - heinghtOneLi +'px';
140                } else {
141                    this.parentNode.parentNode.classList.add('open-sub-sub-menu');
142                }
143                if(this.classList.contains('thereCaretSecond') && this.classList.contains('active') == false) {
144                    this.parentNode.parentNode.style.height = this.parentNode.parentNode.getAttribute('sub-menu-height') +'px';
145                }
146
147            }
148            document.querySelectorAll('header nav .thereCaret').forEach(el=> {
149                el.addEventListener('click', openSubMenus, false);
150            })
151        }
152    }
153    headerMenu();
154
155    //Mobile Sub Menu
156    function subMenusHeight() {
157        var subMenus = document.querySelectorAll('header ul .sub-menu');
158        subMenus.forEach(function (e) {
159            var allLI = e.children;
160            var subMenuHeight = 0;
161            for (var i = 0; i < allLI.length; i++) {
162                subMenuHeight += e.children[i].clientHeight;
163            }
164            e.setAttribute("sub-menu-height", subMenuHeight);
165        })
166    }
167    subMenusHeight();
168
169    function checkAdminBar() {
170            var bodyName = document.getElementsByTagName('body')[0];
171            if (bodyName.classList.contains('admin-bar')) {
172                var topHP = 0 + document.getElementById('wpadminbar').clientHeight;
173            } else {
174                var topHP = 0;
175            }
176            var headerFixing = document.querySelector('header .fixing');
177            headerFixing.style.top = topHP+'px';
178        }
179    checkAdminBar();
180
181    window.addEventListener('scroll', function() {
182        checkAdminBar();
183    }); // end scroll function
184
185    window.addEventListener('resize', function(event) {
186        setTimeout(HH, 1);
187        //setTimeout(PEPFU, 1);
188        checkAdminBar();
189    }, true);
190    //End Header Scripts-----------------------------
191
192
193    //CUSTOM MODALS
194
195    document.querySelectorAll('.open-modal').forEach(el=> {
196        el.addEventListener('click', openModal, false);
197    })
198    function openModal() {
199        var modal = this.getAttribute('attr-modal-name');
200        toggleModal(modal);
201        document.getElementById(modal).classList.add('transition');
202
203    }
204    function toggleModal(modal) {
205        var modal = document.getElementById(modal);
206        modal.classList.toggle("show-modal");
207    }
208
209
210    //close modal
211    document.querySelectorAll('.custom-modal .close-button').forEach(el=> {
212        el.addEventListener('click', closeModal, false);
213    })
214    function closeModal() {
215        var modal = this.closest('.custom-modal ').getAttribute('id');
216        toggleModal(modal);
217        let videoModal = document.getElementById('video-modal');
218        if(videoModal){
219            let videoArea = document.querySelector('#video-modal .video-area');
220            videoArea.innerHTML = '';
221        }  
222    }
223
224    window.addEventListener("click", windowOnClick);
225    function windowOnClick(event) {
226        var modal = document.querySelector('.custom-modal.show-modal');
227        if (event.target === modal) {
228            var modal = document.querySelector('.custom-modal.show-modal').getAttribute('id');
229            toggleModal(modal);
230
231            let videoModal = document.getElementById('video-modal');
232            if(videoModal){
233                let videoArea = document.querySelector('#video-modal .video-area');
234                videoArea.innerHTML = '';
235            }   
236        }
237    } 
238
239// main margin-bottom
240    if (window.innerWidth > 992) {
241        const main = document.querySelector('main');
242        const footer = document.querySelector('footer');
243
244        let footerHeight = footer.offsetHeight;
245        main.style.marginBottom = footerHeight + "px";
246    }
247
248// end margin-bottom
249
250// cursor
251    const cursorSmall = document.getElementById('custom-cursor-circle');
252    const positionElement = (e)=> {
253       
254      const mouseY = e.clientY;
255      const mouseX = e.clientX;       
256      cursorSmall.style.transform = `translate(${mouseX}px, ${mouseY}px)`;     
257    }
258    
259    window.addEventListener('mousemove', positionElement);
260
261    let pageLinks = document.querySelectorAll('a, .projects-area .video-icon-color, .archive_project_section .bottom-info-video');
262    for (var i = 0; i < pageLinks.length; i++) {
263        pageLinks[i].addEventListener("mouseout", function(){
264            cursorSmall.classList.remove('above-link');
265        });
266        pageLinks[i].addEventListener("mouseover", function(){
267            cursorSmall.classList.add('above-link');
268        });
269    }
270}); // End Document Ready

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.