Javascript

How to make a div sticky to the top when you scroll

December 31, 2014

code

I’ve seen this one done many different ways, but I wanted the simplest way to do this with just jQuery and some CSS, no extra plugins. Here’s an example in it’s simplest form:

HTML:

Anthony Montalbano

If it's worth doing, it's worth doing right.

Published on: December 31, 2014

Last modified on: December 8, 2021