DefinitelyTyped/types/headroom.js/headroom.js-tests.ts
Piotr Błażejewicz (Peter Blazejewicz) d046b352bf
feat(headroom.js): correctted module definition (#46487)
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.js
6970a8fffa/types/headroom/tslint.json (L8)

Thanks!
2020-08-05 17:07:30 -07:00

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();