Skip to content

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.

2 participants