Auto-hiding headers have been usually renouned in web pattern for utterly a while. Many blogs and online magazines use a gummy header to keep users engaged and give them approach entrance to a navigation.
15 jQuery Plugins To Make Smart Sticky Elements
It is now common to see certain elements in a site bound to a position when we scroll…Read more
Medium has redefined this feature with a simple judgment that hides a navigation while scrolling down though shows it while scrolling up. This judgment has turn a wildly renouned trend and now we can simply replicate it regulating Headroom.js.
You could make this functionality yourself though because bother? Headroom is tested and supports all vital browsers. It even plays good with jQuery or Zepto if we already have a JS library commissioned on your site.
You’ll find plenty of formula samples in a GitHub repo though here’s a simple example that targets a
var myElement = document.querySelector("#header"); // emanate a Headroom intent flitting in a #header element var headroom = new Headroom(myElement); // initialize a library headroom.init();
init() duty has plenty of options to customize. You can customize a opposite element classes, along with opposite event trigger callbacks where we can embed your possess functions. For instance, if we wish a component to blur after it’s unpinned we would use a
These options are all listed on a main plugin page, so check it out and see what we think. If we wish to see Headroom in action have a demeanour during a pen below that contains a full counterpart of a categorical demo page.
How to Create CSS-only Sticky Footer