-
Notifications
You must be signed in to change notification settings - Fork 34
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
Responsive-news-reader #31
base: master
Are you sure you want to change the base?
Conversation
<div id="newsfeed"> | ||
|
||
</div> | ||
<button onclick="topFunction()" id="myBtn" title="Go to top">Go to Top</button> |
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.
It would be better to keep event handler setting in JS rather than apply inline
}); | ||
|
||
// Tried adding an event listener to 'More news from this source button', but it does not seem to work. | ||
document.querySelectorAll(".news").addEventListener("click", e => { |
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.
querySelectorAll returns a NodeList and we can't set an event handler on it. It would have to be done on each element in list individually
|
||
//Two functions are executed on scroll - sticky header and 'go to top' button | ||
window.onscroll = function() { | ||
myFunction(), scrollFunction(); |
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.
the function calls should be separated by ;
rather than ,
var header = document.querySelector(".header"); | ||
var sticky = header.offsetTop; | ||
// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position | ||
function myFunction() { |
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.
function could have a more descriptive name
<div id="newsfeed"> | ||
|
||
</div> | ||
<button onclick="topFunction()" id="myBtn" title="Go to top">Go to Top</button> |
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.
myBtn
does not tell much about what the button does. Something more descriptive would work better
IT would be great to see an updated README that explains what the project does and any stretch goals you have created |
Unfortunately I still have not managed the 'More news button to work' :(