1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-15 09:35:21 +01:00
blog/_src/_assets/js/_menu.js

28 lines
704 B
JavaScript
Raw Normal View History

2017-09-09 02:44:03 +02:00
$(document).ready(() => {
const thesite = $('.site')
const thelink = $('.menu-btn')
const thepop = $('.nav-popover')
thelink.on('click', e => {
e.preventDefault()
// Toggle menu
thesite.toggleClass('has-menu-open')
// Bind the hide controls
$(document).bind('click.hidethepop', () => {
thesite.removeClass('has-menu-open')
// Unbind the hide controls
$(document).unbind('click.hidethepop')
})
// Dont close thepop when you click on thepop
thepop.on('click', e => {
e.stopPropagation()
})
// And dont close thepop now
e.stopPropagation()
})
})