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

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-11-19 16:52:44 +01:00
var Menu = (function(w, d) {
var thesite = $('.site'),
thelink = $('.menu-btn'),
thepop = $('.nav-popover');
var app, _private;
_private = {
menuShow: function() {
thelink.on('click', function(e) {
e.preventDefault();
// toggle menu
2015-11-28 01:19:31 +01:00
thesite.toggleClass('has-menu-open');
2015-11-19 14:55:49 +01:00
2015-11-19 16:52:44 +01:00
// bind the hide controls
$(document).bind('click.hidethepop', function() {
2015-11-28 01:19:31 +01:00
thesite.removeClass('has-menu-open');
2015-11-19 16:52:44 +01:00
// unbind the hide controls
$(document).unbind('click.hidethepop');
});
// dont close thepop when you click on thepop
thepop.on('click', function(e) {
e.stopPropagation();
});
// and dont close thepop now
2015-11-19 14:55:49 +01:00
e.stopPropagation();
});
2015-11-19 16:52:44 +01:00
}
};
app = {
init: function() {
_private.menuShow();
}
};
return app;
2015-11-19 14:55:49 +01:00
2015-11-19 16:52:44 +01:00
})(window, document);