Hacker News new | comments | show | ask | jobs | submit login

Someone has already mentioned my JS lib to handle this below, but as the author I feel compelled to mention it myself with some additional explanation.

I built headroom.js [0] to handle exactly this. It simply adds classes at scroll up or down so you can be as fancy as you want (or not!) with the show hide effect. You can set a custom offset (eg. Don't invoke the hide/show mechanism until 100px down the page), you can set a tolerance (eg. Must have scrolled more than 10px before hide/show) and a few other features for more advanced usage.

And for fun I built a little playground so you can explore the various features and find a configuration you like [1]

[0] http://wicky.nillia.ms/headroom.js/

[1] http://wicky.nillia.ms/headroom.js/playroom/

(meta: I submitted it here, but it never gained traction, someone else submitted it to designer news and it absolutely blew up, can't believe it almost has 4000 stars!)




Keep it up!! Honestly you deserve more stars..




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: