mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-03 14:36:02 +08:00
Types for JQuery Animate Scroll
This commit is contained in:
24
types/jquery-animate-scroll/index.d.ts
vendored
Normal file
24
types/jquery-animate-scroll/index.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for JQuery Animate Scroll 1.0
|
||||
// Project: https://github.com/risan/jquery-animate-scroll
|
||||
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
export type Options = Partial<{
|
||||
$container: JQuery;
|
||||
speed: number;
|
||||
offset: number;
|
||||
}>;
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
animateScroll(options?: Options): JQuery;
|
||||
scrollHere(options?: Options): JQuery;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
scrollTo(element: JQuery, options?: Options): void;
|
||||
}
|
||||
}
|
||||
21
types/jquery-animate-scroll/jquery-animate-scroll-tests.ts
Normal file
21
types/jquery-animate-scroll/jquery-animate-scroll-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Options } from "jquery-animate-scroll";
|
||||
|
||||
// basic usage
|
||||
$('a').animateScroll();
|
||||
|
||||
$('#article-1').scrollHere();
|
||||
|
||||
$.scrollTo($('#article-1'));
|
||||
|
||||
// with options
|
||||
const options: Options = {
|
||||
$container: $('body'),
|
||||
speed: 1000,
|
||||
offset: -100
|
||||
};
|
||||
|
||||
$('a').animateScroll(options);
|
||||
|
||||
$('#article-1').scrollHere(options);
|
||||
|
||||
$.scrollTo($('#article-1'), options);
|
||||
25
types/jquery-animate-scroll/tsconfig.json
Normal file
25
types/jquery-animate-scroll/tsconfig.json
Normal file
@@ -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-animate-scroll-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/jquery-animate-scroll/tslint.json
Normal file
1
types/jquery-animate-scroll/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{"extends": "dtslint/dt.json"}
|
||||
Reference in New Issue
Block a user