Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Need help on personal site - footer to push up fixed element

I'm in the process of designing my personal site and I ideally want the left fixed column to remain in place unless the footer hits it, then I want it to scroll up as normal.

Demo - Here

Any help on this would be great as I'm been playing around with some javascript, but I just can't seem to get it to function. :(

Many thanks

2 Answers

Michael Alaev
Michael Alaev
5,415 Points

I think you should create a function that listens to the scroll event and when you footer is in the view port that function should be triggered.

You can do it easy with jQuery. Link: http://stackoverflow.com/questions/2627219/jquery-how-can-i-check-if-a-block-in-my-document-is-inside-the-viewport-or-outs

Hope that helps, Mike.

Thanks buddy, I'm still having a few problems but I think that's more down to the layout which might need to be changed slightly.

All done, many many thanks again Michael Alaev :)