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

39 lines
937 B
JavaScript
Raw Normal View History

2015-11-19 16:22:17 +01:00
var s, Menu = {
2015-11-19 14:55:49 +01:00
settings: {
thesite: $('.site'),
thelink: $('.menu-btn'),
thepop: $('.nav-popover')
},
init: function() {
this.menuShow();
},
menuShow: function() {
2015-11-19 16:22:17 +01:00
var s = this.settings;
2015-11-19 14:55:49 +01:00
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();
});
}
2015-11-19 16:07:27 +01:00
};