Sticky

sticky lets you use position sticky on an element with some enhancements.


Position sticky made easy

Instead of having to remember to use position:sticky and top, just use sticky and you’ll have a sticky element.

index.html
<div class="sticky">...</div>
Sticky Top

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticks to the top.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticky on the Bottom, Left, and Right

sticky supports position:sticky on all four directions. To active these other directions, you need to set top to auto and the direction (bottom, left or right) to the value you desire.

index.html
<div class="sticky top-auto bottom-0">...</div>
Sticky Bottom

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticks to the bottom.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Item 1
Item 2
sticky
Sticks to the left
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
sticky
Sticks to the right
Item 9
Item 10
Item 11

Checking if elements are sticking is pretty easy too

Just include our sticky script, then add sticky-check to your sticky element.

Sticky Top

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticks to the top. Turns blue when sticking.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticky Bottom

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Sticks to the bottom. Turns blue when sticking.

Ignore this text and focus on the sticky item instead. The purpose of this is to increase the height of the content so we can showcase the sticky item.

Item 1
Item 2
sticky
Sticks to the left
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
sticky
Sticks to the right
Item 9
Item 10
Item 11