Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions assets/js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,33 @@
}
}

// Full screen nav open on click
// Full screen nav open/close on nav icon click
$('.nav-icon').addEventListener('click', function() {
toggleNav()
})

// Full screen nav close on nav item click
$$('.nav-full a').forEach(function(links) {
links.addEventListener('click', function() {
toggleNav()
})
})

// Full screen nav toggle
function toggleNav() {
$$('.nav-full, main').forEach(function(el) {
el.classList.toggle('active')
})
if (menuActive) {
this.querySelector('img:nth-of-type(1)').style.display = 'inline-block'
this.querySelector('img:nth-of-type(2)').style.display = 'none'
$('.nav-icon').querySelector('img:nth-of-type(1)').style.display = 'inline-block'
$('.nav-icon').querySelector('img:nth-of-type(2)').style.display = 'none'
menuActive = false
} else {
this.querySelector('img:nth-of-type(1)').style.display = 'none'
this.querySelector('img:nth-of-type(2)').style.display = 'inline-block'
$('.nav-icon').querySelector('img:nth-of-type(1)').style.display = 'none'
$('.nav-icon').querySelector('img:nth-of-type(2)').style.display = 'inline-block'
menuActive = true
}
})

// Full screen nav close on click
$$('.nav-full a').forEach(function(links) {
links.addEventListener('click', function() {
$$('.nav-full, main').forEach(function(el) {
el.classList.toggle('active')
})
})
})
}

// Fix logoBig drawing over nav when click on logoSmall while nav open
$('.logo').addEventListener('click', function() {
Expand Down