forked from jrodcode/website-nav-design-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
59 lines (42 loc) · 1.53 KB
/
app.js
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
// ACTIVE NAV BTNS SECTION
const activePage = window.location.pathname;
const navLinks = document.querySelectorAll('.nav-link-btn a');
// console.log(activePage);
navLinks.forEach(link => {
if (link.href.includes(`${activePage}`)) {
link.classList.add("active-nav-links");
}
});
// This is the Nav Icon Showing Mobile Nav
function navMobileBtn() {
var navMobileBtn = $("#nav-icon");
navMobileBtn.click(function() {
navMobileBtn.addClass("open");
$(".nav-mobile-links-container").css("left", "0");
$(".nav-mobile-links-bg").removeClass("nav-mobile-animation-bg-remove");
$(".nav-mobile-links-bg").addClass("nav-mobile-animation-bg");
})
}
navMobileBtn();
// This is for the Click outside Mobile Nav
var mobileNavContainer = $(".nav-mobile-links-bg");
mobileNavContainer.click(function(event) {
const navBtn2 = document.querySelector("#nav-icon");
if (event.target.closest(".nav-mobile-links-content")) return;
navBtn2.classList.remove("open");
$(".nav-mobile-links-container").css("left", "-100%");
$(".nav-mobile-links-bg").removeClass("nav-mobile-animation-bg");
$(".nav-mobile-links-bg").addClass("nav-mobile-animation-bg-remove");
});
function subNavTrigger() {
$(".mobile-nav-links-sub-trigger").click(function() {
$(".mobile-nav-sub-links-1").slideToggle();
})
}
subNavTrigger();
function subNavTrigger2() {
$(".mobile-nav-links-sub-trigger-2").click(function() {
$(".mobile-nav-sub-links-2").slideToggle();
})
}
subNavTrigger2();