stuartwakefield2016-fixed-header

0.1.0 • Public • Published

Stuart Wakefield 2016 Fixed Header

Usage:

bower install --save stuartwakefield2016-fixed-header

API

fixedHeader.createFixedHeader()

Creates a new fixed header behaviour for the current document. Uses the dimensions of the first matched .header element to determine when to trigger the fixed header state. Applies the fixed-header class to the document body when triggered. Removes the fixed-header class from the body when scrolled back to the top.

Returns a new FixedHeader instance.

fixedHeader.applyFixedHeader()

Shortcut for for fixedHeader.createFixedHeader().on().

Returns a new FixedHeader instance.

header.on()

Attaches the behaviour for the fixed header to the current document. This method needs to be called after creating the FixedHeader object for the behaviour to be present.

Returns the scoped FixedHeader instance.

header.off()

Detaches the behaviour for the fixed header. Use this if you need to clean up existing behaviour. By default the FixedHeader will be cleaned up when leaving the page but this method can be used to trigger early cleanup, for example for AJAX loaded pages.

This method should be called, and a new FixedHeader created, if the header element has be rerendered for any reason.

Returns the scoped FixedHeader instance.

Readme

Keywords

none

Package Sidebar

Install

npm i stuartwakefield2016-fixed-header

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • stuartwakefield