-
Notifications
You must be signed in to change notification settings - Fork 34
Slacker News App #10
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
base: master
Are you sure you want to change the base?
Slacker News App #10
Conversation
HTLuff
commented
Jun 18, 2018
- Lastest Tech News button
- Invert colours button
- Hide/Show description button
| const appScreen = document.querySelector('#app'); | ||
| const descriptionToggle = document.querySelector('#descrption-toggle'); | ||
|
|
||
| function createURL(indvCategory){ |
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.
like the helper function use
| return `https://newsapi.org/v2/top-headlines?category=technology&country=gb&apiKey=${newAPIKey}&pagesize=5`; | ||
| } | ||
|
|
||
| function display(newsData){ |
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.
display logic nicely broken out into own function
| const newsDesc = Array.from(document.getElementsByClassName('news-desc')); | ||
| if(descriptionToggle.className.match(/(?:|\s) toggle-on(?!\s)/)){ | ||
| newsDesc.forEach(function(el){ | ||
| el.className = el.className.replace(' toggle-on', ''); |
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.
toggleClass would work well here https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
| } | ||
|
|
||
| .clicked { | ||
| filter: invert(100%); |
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.
nice