1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-09-24 18:18:49 +02:00
blog/_src/_assets/js/_menu.js
2015-11-19 16:22:17 +01:00

39 lines
937 B
JavaScript

var s, Menu = {
settings: {
thesite: $('.site'),
thelink: $('.menu-btn'),
thepop: $('.nav-popover')
},
init: function() {
this.menuShow();
},
menuShow: function() {
var s = this.settings;
s.thelink.on('click', function(e) {
e.preventDefault();
// toggle menu
s.thesite.toggleClass('menu-open');
// bind the hide controls
$(document).bind('click.hidethepop', function() {
s.thesite.removeClass('menu-open');
// unbind the hide controls
$(document).unbind('click.hidethepop');
});
// dont close thepop when you click on thepop
s.thepop.on('click', function(e) {
e.stopPropagation();
});
// and dont close thepop now
e.stopPropagation();
});
}
};