Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Abe Layee
Abe Layee
8,378 Points

How do I make my arrow to scroll to the next section on my website?

Hello everyone. How are we all doing today? I need a little bit of a help. I am trying to write a script that allows my arrow on my website to scroll down when you click on it. Here is link to my codepen. http://codepen.io/Layee/pen/oXYXPP My arrow has an id of scrolldown.

geoffrey
geoffrey
28,736 Points

I guess you want it to scroll down to the next section of your webpage and stop there ? (As I suppose It's a one page website).

3 Answers

geoffrey
geoffrey
28,736 Points

Ok, I did it this way, here, hope It's going to help you a little bit. You'll see that, if the last section to go to is reached, if ever you click again on the arrow, It'll go back to the first section.

That might be cool as well to change the appearence of the arrow if the last section is reached, I mean we could orientate this one to the top instead of the bottom.

Abe Layee
Abe Layee
8,378 Points

Yes, that is what I want to achieve.

Abe Layee
Abe Layee
8,378 Points

Thank you very much bro.