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

Looking to make a left sidebar menu sticky

Hello,

If you take a look at my site:

You'll notice a menu on the left hand side - I need this to be a sticky menu and to follow you while you scroll down.

How do I do this?

Thanks for your time!!

Hey Brandon Brigham,

.simplify-disc-left-nav {
    margin-left: -15px;
    width: calc(100% + 15px);
    position: fixed;
}

1 Answer

Steven Parker
Steven Parker
243,318 Points

I was actually wondering why you had not done that already!

.simplify-disc-left-nav {
    position: fixed;
}

Steven thanks! do you think using your solution will be better than the one above?

Steven Parker
Steven Parker
243,318 Points

I don't think the width is necessary, and the margin doesn't need to move unless you don't like the original position. In that case, you can place it anywhere you like using left.

K thanks Steven, and thanks Ashish as well for your time