2015-11-19 16:52:44 +01:00
|
|
|
var Menu = (function(w, d) {
|
|
|
|
|
2015-12-02 00:46:25 +01:00
|
|
|
var app, _private, _config;
|
2015-11-19 16:52:44 +01:00
|
|
|
|
2015-12-02 00:46:25 +01:00
|
|
|
_config = {
|
|
|
|
thesite : $('.site'),
|
|
|
|
thelink : $('.menu-btn'),
|
|
|
|
thepop : $('.nav-popover')
|
|
|
|
};
|
2015-11-19 16:52:44 +01:00
|
|
|
|
|
|
|
_private = {
|
|
|
|
menuShow: function() {
|
2015-12-02 00:46:25 +01:00
|
|
|
_config.thelink.on('click', function(e) {
|
2015-11-19 16:52:44 +01:00
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
// toggle menu
|
2015-12-02 00:46:25 +01:00
|
|
|
_config.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-12-02 00:46:25 +01:00
|
|
|
_config.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
|
2015-12-02 00:46:25 +01:00
|
|
|
_config.thepop.on('click', function(e) {
|
2015-11-19 16:52:44 +01:00
|
|
|
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);
|