mirror of
https://github.com/status-im/nimbus-site.git
synced 2025-01-22 09:50:04 +00:00
23 lines
600 B
JavaScript
23 lines
600 B
JavaScript
|
(function() {
|
||
|
'use strict';
|
||
|
|
||
|
var body = document.getElementsByTagName('body')[0];
|
||
|
var navToggle = document.getElementById('mobile-nav-toggle');
|
||
|
var dimmer = document.getElementById('mobile-nav-dimmer');
|
||
|
var CLASS_NAME = 'mobile-nav-on';
|
||
|
if (!navToggle) return;
|
||
|
|
||
|
navToggle.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
body.classList.toggle(CLASS_NAME);
|
||
|
});
|
||
|
|
||
|
dimmer.addEventListener('click', function(e) {
|
||
|
if (!body.classList.contains(CLASS_NAME)) return;
|
||
|
|
||
|
e.preventDefault();
|
||
|
body.classList.remove(CLASS_NAME);
|
||
|
});
|
||
|
}());
|