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 = {
|
|
|
|
thesite: $('.site'),
|
|
|
|
thelink: $('.menu-btn'),
|
|
|
|
thepop: $('.nav-popover')
|
|
|
|
}
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
const _private = {
|
|
|
|
toggleMenu() {
|
|
|
|
_config.thelink.on('click', e => {
|
|
|
|
e.preventDefault()
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
// Toggle menu
|
|
|
|
_config.thesite.toggleClass('has-menu-open')
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
// Bind the hide controls
|
|
|
|
$(document).bind('click.hidethepop', () => {
|
|
|
|
_config.thesite.removeClass('has-menu-open')
|
|
|
|
// Unbind the hide controls
|
|
|
|
$(document).unbind('click.hidethepop')
|
|
|
|
})
|
2017-09-09 02:44:03 +02:00
|
|
|
|
2017-09-09 19:22:04 +02:00
|
|
|
// Dont close thepop when you click on thepop
|
|
|
|
_config.thepop.on('click', e => {
|
|
|
|
e.stopPropagation()
|
|
|
|
})
|
|
|
|
|
|
|
|
// And dont close thepop now
|
|
|
|
e.stopPropagation()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
init: _private.toggleMenu
|
|
|
|
}
|
|
|
|
})(); // eslint-disable-line semi
|