mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 13:27:15 +08:00
Merge pull request #23747 from AndersonFriaca/jquery-lazyload
Types for jquery-lazyload
This commit is contained in:
26
types/jquery-lazyload/index.d.ts
vendored
Normal file
26
types/jquery-lazyload/index.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for JQuery Lazy Load 1.9
|
||||
// Project: https://github.com/tuupola/jquery_lazyload
|
||||
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare namespace JQueryLazyLoad {
|
||||
interface Options {
|
||||
threshold?: number;
|
||||
failure_limit?: number;
|
||||
event?: string;
|
||||
effect?: string;
|
||||
container?: JQuery;
|
||||
data_attribute?: string;
|
||||
skip_invisible?: boolean;
|
||||
appear?: null;
|
||||
load?: (elementsLeft?: number, options?: Options) => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
}
|
||||
interface JQuery {
|
||||
lazyload(options?: JQueryLazyLoad.Options): JQuery;
|
||||
on(event: 'load', callback: ((options?: JQueryLazyLoad.Options) => void)): JQuery;
|
||||
}
|
||||
20
types/jquery-lazyload/jquery-lazyload-tests.ts
Normal file
20
types/jquery-lazyload/jquery-lazyload-tests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
$(document).ready(() => {
|
||||
// basic usage
|
||||
$('.lazyload').lazyload();
|
||||
|
||||
// with options
|
||||
const options: JQueryLazyLoad.Options = {
|
||||
threshold: 200,
|
||||
event: 'click',
|
||||
effect: 'fadeIn',
|
||||
container: $('#container'),
|
||||
failure_limit: 10,
|
||||
skip_invisible: true
|
||||
};
|
||||
$('.lazyload').lazyload(options);
|
||||
|
||||
// event on load
|
||||
$('.lazyload').on('load', () => {
|
||||
$("img.lazy").trigger("click");
|
||||
});
|
||||
});
|
||||
25
types/jquery-lazyload/tsconfig.json
Normal file
25
types/jquery-lazyload/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-lazyload-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/jquery-lazyload/tslint.json
Normal file
1
types/jquery-lazyload/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{"extends": "dtslint/dt.json"}
|
||||
Reference in New Issue
Block a user