Merge pull request #3085 from hakubo/Headroom-definitions

add definitions for Headroom
This commit is contained in:
Masahiro Wakame 2014-11-05 14:22:28 +09:00
commit 8acd48dbd7
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,13 @@
/// <reference path="headroom.d.ts" />
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], {
offset: 500
});

28
Headroom/headroom.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
// Type definitions for headroom.js v0.7.0
// Project: http://wicky.nillia.ms/headroom.js/
// Definitions by: Jakub Olek <https://github.com/hakubo/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface HeadroomOptions {
offset?: number;
tolerance?: any;
classes?: {
initial?: string;
pinned?: string;
unpinned?: string;
top?: string;
notTop?: string;
};
scroller?: Element;
onPin?: () => void;
onUnPin?: () => void;
onTop?: () => void;
onNotTop?: () => void;
}
declare class Headroom {
constructor(element: Node, options?: HeadroomOptions);
constructor(element: Element, options?: HeadroomOptions);
init: () => void;
}