Last active
June 21, 2018 09:40
-
-
Save mmintel/fd202187767933a6f6bcfeeefa9d64f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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