Skip to content

Instantly share code, notes, and snippets.

@mmintel
Last active June 21, 2018 09:40
Show Gist options
  • Save mmintel/fd202187767933a6f6bcfeeefa9d64f5 to your computer and use it in GitHub Desktop.
Save mmintel/fd202187767933a6f6bcfeeefa9d64f5 to your computer and use it in GitHub Desktop.
import Headroom from '../lib/headroom';
export default function init(app) {
const headroom = new Headroom({
nodes: document.queryAll('[data-headroom]'),
}).init();
const header = headroom.find('page-header');
if (header) {
header.onToggle((instance) => {
const { stickies } = app.modules;
if (stickies) {
const share = stickies.find('share');
if (share) {
share.offset(instance.model.isVisible ? dom.getNodeHeight(instance.view.node) : 0);
}
}
});
}
return headroom;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment