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

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 :)