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

Responsive-news-reader #31

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

YelChristensen
Copy link

Unfortunately I still have not managed the 'More news button to work' :(

<div id="newsfeed">

</div>
<button onclick="topFunction()" id="myBtn" title="Go to top">Go to Top</button>
Copy link
Contributor

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 => {
Copy link
Contributor

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();
Copy link
Contributor

@dmitrigrabov dmitrigrabov Sep 18, 2018

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() {
Copy link
Contributor

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>
Copy link
Contributor

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

@dmitrigrabov
Copy link
Contributor

IT would be great to see an updated README that explains what the project does and any stretch goals you have created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants