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!
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

Matthew Sambrook
2,255 PointsScroll to top button script that works on mobile devices!
Hi All -
I'm working on a project for myself and I'm trying to add a scroll to top button that works on mobile devices. I've found several jQuery scripts that work on desktop browsers but don't seem to work correctly on mobile devices.
Just some extra info - my project is using Bootstrap 3.
Any suggestions?
Thanks!
Matthew

Matthew Sambrook
2,255 PointsHi Keith -
Thanks for responding. I am looking to add a fade in button that shows up after getting past a certain pixel threshold on scrolling. I'm going to try Nick's answer below.
Thanks again!
Matthew
1 Answer

Nick Pettit
Treehouse TeacherHi Matthew Sambrook,
This bit of jQuery will probably do what you're looking for: http://tympanus.net/codrops/2010/01/03/scrolling-to-the-top-and-bottom-with-jquery/
Keep in mind that most mobile browsers allow users to simply tap the menu bar at the top of the screen to scroll back to the top of a webpage, so this might not be a necessary addition.

Matthew Sambrook
2,255 PointsHi Nick -
Thanks for the link! I didn't know that you could tap the bottom of the browser to scroll back to the top, good info.
Thanks!
Matthew
Keith Wyland
10,576 PointsKeith Wyland
10,576 PointsCan the button just be a simple link that has an href of "#"? Or does it need to be a script with animation?