Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on review #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

**Result**

- [UPDATE DEMO LINK](https://<your_account>.github.io/<repo_name>/)
- [DEMO LINK](https://VitaliyBondarenko1982.github.io/based-landing/)
30 changes: 0 additions & 30 deletions dist/images/logo.svg

This file was deleted.

329 changes: 326 additions & 3 deletions dist/index.html

Large diffs are not rendered by default.

44 changes: 43 additions & 1 deletion dist/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
'use strict';

console.log('hello mate academy!');
const ESC_KEYCODE = 27;
const ENTER_KEYCODE = 13;

const navMain = document.querySelector('.nav');
const navToggle = document.querySelector('.nav__toggle');
const header = document.querySelector('.header');

const onToggleEscPress = function(evt) {
if (evt.keyCode === ESC_KEYCODE) {
closeMenu();
}
};

const openMenu = function() {
navMain.classList.remove('nav--closed');
navMain.classList.add('nav--opened');
header.classList.add('header--hidden');
document.addEventListener('keydown', onToggleEscPress);
};

const closeMenu = function() {
navMain.classList.add('nav--closed');
navMain.classList.remove('nav--opened');
header.classList.remove('header--hidden');
document.removeEventListener('keydown', onToggleEscPress);
};

navToggle.addEventListener('click', function() {
if (navMain.classList.contains('nav--closed')) {
openMenu();
} else {
closeMenu();
}
});

navToggle.addEventListener('keydown', function(evt) {
if (evt.keyCode === ENTER_KEYCODE
&& navMain.classList.contains('nav--closed')) {
closeMenu();
} else {
openMenu();
}
});
Loading