forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblazy-tests.ts
44 lines (40 loc) · 904 Bytes
/
blazy-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/// <reference path="blazy.d.ts" />
/* Constructor test */
var tester: BlazyInstance = new Blazy({
breakpoints: [
{
width: 420,
src: 'data-src-small'
},
{
width: 768,
src: 'data-src-medium'
}
],
container: '#scrolling-container',
error: function(ele: HTMLElement, msg: string) {
if (msg === 'missing') {
console.log('missing');
}
else if (msg === 'invalid') {
console.log('invalid');
}
},
errorClass: 'b-error',
loadInvisible: false,
offset: 100,
saveViewportOffsetDelay: 50,
selector: '.b-lazy',
separator: '|',
src: 'data-src',
success: function(ele: HTMLElement) {
console.log('success');
},
successClass: 'b-loaded',
validateDelay: 25
});
/* Functions tests */
tester.revalidate();
var elements = <NodeList>document.getElementsByTagName('img');
tester.load(elements, true);
tester.destroy();