diff --git a/types/jquery.stickem/index.d.ts b/types/jquery.stickem/index.d.ts new file mode 100644 index 0000000000..50e759635e --- /dev/null +++ b/types/jquery.stickem/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for jquery.stickem.js 1.4 +// Project: https://github.com/davist11/jQuery-Stickem +// Definitions by: David Paz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +interface StickemSettings { + /** + * selector for element to make sticky + */ + item?: string; + + /** + * selector for content container, sizes matched with `item` + */ + container?: string; + + /** + * css class used to apply + */ + stickClass?: string; + + /** + * css class used to apply when ending sticky + */ + endStickClass?: string; + + /** + * offset to use for the sticky element in the parent element + */ + offset?: number | string; + + /** + * where to place sticky element + */ + start?: number | string; + + /** + * Callback to execute when in stick state + */ + onStick?: () => void; + + /** + * Callback to execute when getting out of stick state + */ + onUnstick?: () => void; +} + +interface JQuery { + stickem(settings?: StickemSettings): JQuery; +} diff --git a/types/jquery.stickem/jquery.stickem-tests.ts b/types/jquery.stickem/jquery.stickem-tests.ts new file mode 100644 index 0000000000..572bdf7773 --- /dev/null +++ b/types/jquery.stickem/jquery.stickem-tests.ts @@ -0,0 +1,19 @@ +// without options +$('div').stickem(); + +jQuery('div').stickem(); + +// with options +$('div').stickem({item: + '.stickem', + container: '.stickem-container', + stickClass: 'stickit', + endStickClass: 'stickit-end' +}); + +jQuery('div').stickem({ + item: '.stickem', + container: '.stickem-container', + stickClass: 'stickit', + endStickClass: 'stickit-end' +}); diff --git a/types/jquery.stickem/tsconfig.json b/types/jquery.stickem/tsconfig.json new file mode 100644 index 0000000000..120d2c1526 --- /dev/null +++ b/types/jquery.stickem/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery.stickem-tests.ts" + ] +} diff --git a/types/jquery.stickem/tslint.json b/types/jquery.stickem/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/jquery.stickem/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}