80tmp.js
3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// source --> http://commonwell.test/wp-content/themes/commonwell-corp/scripts/moblie_menu.js?ver=eb276de0ff0635440df790c71d6d729b
jQuery(document).ready(
function ($) {
// Hide Header on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = ($('#mainNav').outerHeight() / 2);
$(window).scroll(
function (event) {
didScroll = true;
}
);
setInterval(
function () {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250
);
function hasScrolled() {
var st = $(this).scrollTop();
// Make sure they scroll more than delta
if (Math.abs(lastScrollTop - st) <= delta)
return;
//console.log($(location).attr('pathname'));
// If they scrolled down and are past the navbar, add class .nav-up.
// This is necessary so you never see what is "behind" the navbar.
if (st > lastScrollTop && st > navbarHeight) {
// Scroll Down
if ($(location).attr('pathname') == '/broker-landing-page/') {
$('#mainNav').removeClass('landing-nav-down').addClass('landing-nav-up');
} else {
$('#mainNav').removeClass('nav-down').addClass('nav-up');
}
$('#content-wrap').removeClass('wrap-down').addClass('wrap-up');
} else {
// Scroll Up
if (st + $(window).height() < $(document).height()) {
if ($(location).attr('pathname') == '/broker-landing-page/') {
$('#mainNav').removeClass('landing-nav-up').addClass('landing-nav-down');
} else {
$('#mainNav').removeClass('nav-up').addClass('nav-down');
}
$('#content-wrap').removeClass('wrap-up').addClass('wrap-down');
}
}
lastScrollTop = st;
}
var $menu = $('#mySidenav');
$(document).mouseup(function (e) {
if ($(e.target).is('#mobile-menu-btn')){
$('.menu-item-has-children').removeClass('open-menu');
$("#mySidenav").toggleClass('mobile-open');
} else {
if($(e.target).parents('#mySidenav').length == 0) {
$('.menu-item-has-children').removeClass('open-menu');
$("#mySidenav").removeClass('mobile-open');
}
}
});
if(window.location.hash && jQuery('#quiz').length > 0) {
$('html, body').animate({scrollTop:0});
var elm = window.location.hash.replace('#', '');
elm = document.getElementById(elm);
setTimeout(function() {
$('html, body').stop().animate({ scrollTop: elm.offsetTop + 10 }, 900, 'linear');
}, 240);
}
});
// function openNav(e) {
// jQuery("#mySidenav").removeClass('mobile-close');
// jQuery("#mySidenav").addClass('mobile-open');
// }
/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */
// function closeNav() {
// jQuery("#mySidenav").removeClass('mobile-open');
// jQuery("#mySidenav").addClass('mobile-close');
// };