mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
This commit corrects definition of `headroom.js` to support proper NPM name and also adds some more details to the implementation. Authors of `types/headroom` are left as the owners of original implementation in this PR. Changes: - package name - DT header details - default settings for linter/styles - maintainer added https://github.com/WickyNilliams/headroom.js https://github.com/WickyNilliams/headroom.js/blob/master/src/Headroom.js See tests of the 'types/headroom' version, which does not match package name:6970a8fffa/types/headroom/headroom-tests.ts (L1)and the header of current `types/headroom`:6970a8fffa/types/headroom/index.d.ts (L1)The types should be `types/headroom.js`: https://www.npmjs.com/package/headroom.js6970a8fffa/types/headroom/tslint.json (L8)Thanks!
34 lines
844 B
TypeScript
34 lines
844 B
TypeScript
import Headroom = require('headroom.js');
|
|
|
|
new Headroom(document.getElementById('siteHead')!);
|
|
|
|
new Headroom(document.getElementsByClassName('siteHead')[0]);
|
|
|
|
new Headroom(document.getElementsByClassName('siteHead')[0], {
|
|
tolerance: 34,
|
|
});
|
|
|
|
new Headroom(document.getElementsByClassName('siteHead')[0], {
|
|
classes: {
|
|
bottom: 'headroom--bottom',
|
|
frozen: 'headeroom--frozen',
|
|
initial: 'headroom',
|
|
notBottom: 'headroom--not-bottom',
|
|
notTop: 'headeroom--not-top',
|
|
pinned: 'headeroom--pinned',
|
|
top: 'headroom--top',
|
|
unpinned: 'headroom--unpinned',
|
|
},
|
|
offset: 500,
|
|
});
|
|
|
|
const header = document.querySelector('header')!;
|
|
|
|
const headroom = new Headroom(header);
|
|
headroom.init();
|
|
headroom.freeze();
|
|
headroom.pin();
|
|
headroom.unpin();
|
|
headroom.unfreeze();
|
|
headroom.destroy();
|