2017-09-09 19:22:04 +02:00
|
|
|
/* exported krlcMenu */
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
const krlcMenu = (() => { // eslint-disable-line no-unused-vars
|
|
|
|
const _config = {
|
2017-09-09 19:35:12 +02:00
|
|
|
thesite: document.getElementsByClassName('site')[0],
|
|
|
|
thelink: document.getElementsByClassName('menu-btn')[0],
|
|
|
|
thepop: document.getElementsByClassName('nav-popover')[0]
|
2017-09-09 19:22:04 +02:00
|
|
|
}
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
const _private = {
|
|
|
|
toggleMenu() {
|
2017-09-09 19:35:12 +02:00
|
|
|
_config.thelink.addEventListener('click', e => {
|
2017-09-09 19:22:04 +02:00
|
|
|
e.preventDefault()
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
// Toggle menu
|
2017-09-09 19:35:12 +02:00
|
|
|
_config.thesite.classList.toggle('has-menu-open')
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
// Dont close thepop when you click on thepop
|
2017-09-09 19:35:12 +02:00
|
|
|
_config.thepop.addEventListener('click', e => {
|
2017-09-09 19:22:04 +02:00
|
|
|
e.stopPropagation()
|
|
|
|
})
|
|
|
|
|
|
|
|
// And dont close thepop now
|
|
|
|
e.stopPropagation()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
init: _private.toggleMenu
|
|
|
|
}
|
|
|
|
})(); // eslint-disable-line semi
|