mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-12 08:05:18 +01:00
38 lines
920 B
JavaScript
38 lines
920 B
JavaScript
var Menu = {
|
|
|
|
settings: {
|
|
thesite: $('.site'),
|
|
thelink: $('.menu-btn'),
|
|
thepop: $('.nav-popover')
|
|
},
|
|
|
|
init: function() {
|
|
s = this.settings;
|
|
this.menuShow();
|
|
},
|
|
|
|
menuShow: function() {
|
|
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();
|
|
});
|
|
}
|
|
}
|