Scrolldir

scrolldir

leverage scroll direction with CSS ⬆⬇

0 dep, 1KB micro JS lib to easily leverage vertical scroll direction in CSS via a data attribute.

Get it: npm install scrolldir

Sample usage:

1
2
3
4
5
6
7
8
9
scrollDir();

scrollDir({ attribute: 'new-attribute-name' });

scrollDir({ el: 'your-new-selector' });

scrollDir({ off: true });

scrollDir({ direction: 'up' });

ScrollDir will set the data-scrolldir attribute on the <html> element to up or down.

GIF FTW!

scrolldir.gif

Suggest a module

Comments