-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
vovan-DOM #164
vovan-DOM #164
Conversation
Hey! Congratulations on your PR! 😎😎😎 Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code. Go through the requirements/most common mistakes listed/linked below and fix the code as appropriate. If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat. When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly. Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒 Please, make sure you haven't made common mistakes Universal recommendations:
Also take a note of the requirements above and follow them in all your future projects. Sincerely yours, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. See some comments below.
submissions/vovan-zt/DOM/script.js
Outdated
}); | ||
|
||
closeElem.addEventListener('click', () => { | ||
menu.classList.remove('active'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try property toggle
function toggleMenu() {
.....
}
humburgerBtn.addEventListener('click', toggleMenu))
closeBtn.addEventListener('click', toggleMenu))
submissions/vovan-zt/DOM/script.js
Outdated
} | ||
|
||
function tabContent() { | ||
menuList.addEventListener('click', ({target}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate eventListener
and function.
submissions/vovan-zt/DOM/script.js
Outdated
|
||
function toggleContent (target) { | ||
for(let key in dataContent) { | ||
if (target.getAttribute('data-content') == key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, it will be more correct target.dataset.content
submissions/vovan-zt/DOM/script.js
Outdated
} | ||
} | ||
|
||
menuList.addEventListener('click', ({target}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate listener and function.
menuList.addEventListener('click', showContent)
submissions/vovan-zt/DOM/script.js
Outdated
@@ -0,0 +1,97 @@ | |||
"use strict"; | |||
window.addEventListener ('DOMContentLoaded', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave only
window.addEventListener ('DOMContentLoaded', () => {
menuList.addEventListener('click', showContent);
hamburgerBtn.addEventListener('click', toggleMenu);
closeBtn.addEventListener('click', toggleMenu);
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I approve of your work. Good luck with the future tasks!
DOM
Demo |
Code base
The code is submitted in a dedicated feature branch.
Only code files are submitted.
Please, review.