forked from emeryberger/CSrankings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.d.ts
12942 lines (12939 loc) · 376 KB
/
jquery.d.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// tslint:disable:jsdoc-format
// tslint:disable:max-line-length
// tslint:disable:no-irregular-whitespace
interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
/**
* A string containing the jQuery version number.
* @see \`{@link https://api.jquery.com/jquery-2/#jquery1 }\`
* @since 1.0
* @example ````Determine if an object is a jQuery object
```javascript
var a = { what: "A regular JS object" },
b = $( "body" );
if ( a.jquery ) { // Falsy, since it's undefined
alert( "a is a jQuery object!" );
}
if ( b.jquery ) { // Truthy, since it's a string
alert( "b is a jQuery object!" );
}
```
* @example ````Get the current version of jQuery running on the page
```javascript
alert( "You are running jQuery version: " + $.fn.jquery );
```
*/
jquery: string;
/**
* The number of elements in the jQuery object.
* @see \`{@link https://api.jquery.com/length/ }\`
* @since 1.0
* @example ````Count the divs. Click to add more.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>length demo</title>
<style>
body {
cursor: pointer;
}
div {
width: 50px;
height: 30px;
margin: 5px;
float: left;
background: green;
}
span {
color: red;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<span></span>
<div></div>
<script>
$( document.body )
.click(function() {
$( document.body ).append( $( "<div>" ) );
var n = $( "div" ).length;
$( "span" ).text( "There are " + n + " divs." +
"Click to add more.");
})
// Trigger the click to start
.trigger( "click" );
</script>
</body>
</html>
```
*/
length: number;
/**
* Create a new jQuery object with elements added to the set of matched elements.
* @param selector A string representing a selector expression to find additional elements to add to the set of matched elements.
* @param context The point in the document at which the selector should begin matching; similar to the context
* argument of the $(selector, context) method.
* @see \`{@link https://api.jquery.com/add/ }\`
* @since 1.4
*/
add(selector: JQuery.Selector, context: Element): this;
// TODO: The return type should reflect newly selected types.
/**
* Create a new jQuery object with elements added to the set of matched elements.
* @param selector_elements_html_selection _@param_ `selector_elements_html_selection`
* <br>
* * `selector` — A string representing a selector expression to find additional elements to add to the set of matched elements. <br>
* * `elements` — One or more elements to add to the set of matched elements. <br>
* * `html` — An HTML fragment to add to the set of matched elements. <br>
* * `selection` — An existing jQuery object to add to the set of matched elements.
* @see \`{@link https://api.jquery.com/add/ }\`
* @since 1.0
* @since 1.3.2
* @example ````Finds all divs and makes a border. Then adds all paragraphs to the jQuery object to set their backgrounds yellow.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>add demo</title>
<style>
div {
width: 60px;
height: 60px;
margin: 10px;
float: left;
}
p {
clear: left;
font-weight: bold;
font-size: 16px;
color: blue;
margin: 0 10px;
padding: 2px;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<p>Added this... (notice no border)</p>
<script>
$( "div" ).css( "border", "2px solid red" )
.add( "p" )
.css( "background", "yellow" );
</script>
</body>
</html>
```
* @example ````Adds more elements, matched by the given expression, to the set of matched elements.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>add demo</title>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<span>Hello Again</span>
<script>
$( "p" ).add( "span" ).css( "background", "yellow" );
</script>
</body>
</html>
```
* @example ````Adds more elements, created on the fly, to the set of matched elements.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>add demo</title>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<script>
$( "p" ).clone().add( "<span>Again</span>" ).appendTo( document.body );
</script>
</body>
</html>
```
* @example ````Adds one or more Elements to the set of matched elements.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>add demo</title>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<span id="a">Hello Again</span>
<script>
$( "p" ).add( document.getElementById( "a" ) ).css( "background", "yellow" );
</script>
</body>
</html>
```
* @example ````Demonstrates how to add (or push) elements to an existing collection
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>add demo</title>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<span id="a">Hello Again</span>
<script>
var collection = $( "p" );
// Capture the new collection
collection = collection.add( document.getElementById( "a" ) );
collection.css( "background", "yellow" );
</script>
</body>
</html>
```
*/
add(selector_elements_html_selection: JQuery.Selector | JQuery.TypeOrArray<Element> | JQuery.htmlString | JQuery | JQuery.Node): this;
/**
* Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
* @param selector A string containing a selector expression to match the current set of elements against.
* @see \`{@link https://api.jquery.com/addBack/ }\`
* @since 1.8
* @example ````The .addBack() method causes the previous set of DOM elements in the traversal stack to be added to the current set. In the first example, the top stack contains the set resulting from .find("p"). In the second example, .addBack() adds the previous set of elements on the stack — in this case $("div.after-addback") — to the current set, selecting both the div and its enclosed paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>addBack demo</title>
<style>
p, div {
margin: 5px;
padding: 5px;
}
.border {
border: 2px solid red;
}
.background {
background: yellow;
}
.left, .right {
width: 45%;
float: left;
}
.right {
margin-left: 3%;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<div class="left">
<p><strong>Before <code>addBack()</code></strong></p>
<div class="before-addback">
<p>First Paragraph</p>
<p>Second Paragraph</p>
</div>
</div>
<div class="right">
<p><strong>After <code>addBack()</code></strong></p>
<div class="after-addback">
<p>First Paragraph</p>
<p>Second Paragraph</p>
</div>
</div>
<script>
$( "div.left, div.right" ).find( "div, div > p" ).addClass( "border" );
// First Example
$( "div.before-addback" ).find( "p" ).addClass( "background" );
// Second Example
$( "div.after-addback" ).find( "p" ).addBack().addClass( "background" );
</script>
</body>
</html>
```
*/
addBack(selector?: JQuery.Selector): this;
/**
* Adds the specified class(es) to each element in the set of matched elements.
* @param className_function _@param_ `className_function`
* <br>
* * `className` — One or more space-separated classes to be added to the class attribute of each matched element. <br>
* * `function` — A function returning one or more space-separated class names to be added to the existing class
* name(s). Receives the index position of the element in the set and the existing class name(s) as
* arguments. Within the function, `this` refers to the current element in the set.
* @see \`{@link https://api.jquery.com/addClass/ }\`
* @since 1.0
* @since 1.4
* @since 3.3
* @example ````Add the class "selected" to the matched elements.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>addClass demo</title>
<style>
p {
margin: 8px;
font-size: 16px;
}
.selected {
color: blue;
}
.highlight {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<p>and</p>
<p>Goodbye</p>
<script>
$( "p" ).last().addClass( "selected" );
</script>
</body>
</html>
```
* @example ````Add the classes "selected" and "highlight" to the matched elements.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>addClass demo</title>
<style>
p {
margin: 8px;
font-size: 16px;
}
.selected {
color: red;
}
.highlight {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>Hello</p>
<p>and</p>
<p>Goodbye</p>
<script>
$( "p:last" ).addClass( "selected highlight" );
</script>
</body>
</html>
```
* @example ````Pass in a function to .addClass() to add the "green" class to a div that already has a "red" class.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>addClass demo</title>
<style>
div {
background: white;
}
.red {
background: red;
}
.red.green {
background: green;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<div>This div should be white</div>
<div class="red">This div will be green because it now has the "green" and "red" classes.
It would be red if the addClass function failed.</div>
<div>This div should be white</div>
<p>There are zero green divs</p>
<script>
$( "div" ).addClass(function( index, currentClass ) {
var addedClass;
if ( currentClass === "red" ) {
addedClass = "green";
$( "p" ).text( "There is one green div" );
}
return addedClass;
});
</script>
</body>
</html>
```
*/
addClass(className_function: JQuery.TypeOrArray<string> | ((this: TElement, index: number, currentClassName: string) => string)): this;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
* @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
* jQuery objects to insert after each element in the set of matched elements.
* @see \`{@link https://api.jquery.com/after/ }\`
* @since 1.0
* @example ````Inserts some HTML after all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>after demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>I would like to say: </p>
<script>
$( "p" ).after( "<b>Hello</b>" );
</script>
</body>
</html>
```
* @example ````Inserts a DOM element after all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>after demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>I would like to say: </p>
<script>
$( "p" ).after( document.createTextNode( "Hello" ) );
</script>
</body>
</html>
```
* @example ````Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>after demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<b>Hello</b>
<p>I would like to say: </p>
<script>
$( "p" ).after( $( "b" ) );
</script>
</body>
</html>
```
*/
after(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
* @param function_functionーhtml _@param_ `function_functionーhtml`
* <br>
* * `function` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
* after each element in the set of matched elements. Receives the index position of the element in the
* set as an argument. Within the function, `this` refers to the current element in the set. <br>
* * `functionーhtml` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
* after each element in the set of matched elements. Receives the index position of the element in the
* set and the old HTML value of the element as arguments. Within the function, `this` refers to the
* current element in the set.
* @see \`{@link https://api.jquery.com/after/ }\`
* @since 1.4
* @since 1.10
*/
after(function_functionーhtml: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>): this;
/**
* Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxComplete/ }\`
* @since 1.0
* @example ````Show a message when an Ajax request completes.
```javascript
$( document ).ajaxComplete(function( event, request, settings ) {
$( "#msg" ).append( "<li>Request Complete.</li>" );
});
```
*/
ajaxComplete(handler: (this: Document,
event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
jqXHR: JQuery.jqXHR,
ajaxOptions: JQuery.AjaxSettings) => void | false): this;
/**
* Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxError/ }\`
* @since 1.0
* @example ````Show a message when an Ajax request fails.
```javascript
$( document ).ajaxError(function( event, request, settings ) {
$( "#msg" ).append( "<li>Error requesting page " + settings.url + "</li>" );
});
```
*/
ajaxError(handler: (this: Document,
event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
jqXHR: JQuery.jqXHR,
ajaxSettings: JQuery.AjaxSettings,
thrownError: string) => void | false): this;
/**
* Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxSend/ }\`
* @since 1.0
* @example ````Show a message before an Ajax request is sent.
```javascript
$( document ).ajaxSend(function( event, request, settings ) {
$( "#msg" ).append( "<li>Starting request at " + settings.url + "</li>" );
});
```
*/
ajaxSend(handler: (this: Document,
event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
jqXHR: JQuery.jqXHR,
ajaxOptions: JQuery.AjaxSettings) => void | false): this;
/**
* Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxStart/ }\`
* @since 1.0
* @example ````Show a loading message whenever an Ajax request starts (and none is already active).
```javascript
$( document ).ajaxStart(function() {
$( "#loading" ).show();
});
```
*/
ajaxStart(handler: (this: Document) => void | false): this;
/**
* Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxStop/ }\`
* @since 1.0
* @example ````Hide a loading message after all the Ajax requests have stopped.
```javascript
$( document ).ajaxStop(function() {
$( "#loading" ).hide();
});
```
*/
ajaxStop(handler: (this: Document) => void | false): this;
/**
* Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
* @param handler The function to be invoked.
* @see \`{@link https://api.jquery.com/ajaxSuccess/ }\`
* @since 1.0
* @example ````Show a message when an Ajax request completes successfully.
```javascript
$( document ).ajaxSuccess(function( event, request, settings ) {
$( "#msg" ).append( "<li>Successful Request!</li>" );
});
```
*/
ajaxSuccess(handler: (this: Document,
event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
jqXHR: JQuery.jqXHR,
ajaxOptions: JQuery.AjaxSettings,
data: JQuery.PlainObject) => void | false): this;
/**
* Perform a custom animation of a set of CSS properties.
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete, called once per matched element.
* @see \`{@link https://api.jquery.com/animate/ }\`
* @since 1.0
* @example ````An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function. Note, this code will do nothing unless the paragraph element is hidden.
```javascript
$( "p" ).animate({
opacity: "show"
}, "slow", "easein" );
```
* @example ````Animate all paragraphs and execute a callback function when the animation is complete. The first argument is an object of CSS properties, the second specifies that the animation should take 1000 milliseconds to complete, the third states the easing type, and the fourth argument is an anonymous callback function.
```javascript
$( "p" ).animate({
height: 200,
width: 400,
opacity: 0.5
}, 1000, "linear", function() {
alert( "all done" );
});
```
*/
animate(properties: JQuery.PlainObject,
duration: JQuery.Duration,
easing: string,
complete?: (this: TElement) => void): this;
/**
* Perform a custom animation of a set of CSS properties.
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration_easing _@param_ `duration_easing`
* <br>
* * `duration` — A string or number determining how long the animation will run. <br>
* * `easing` — A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete, called once per matched element.
* @see \`{@link https://api.jquery.com/animate/ }\`
* @since 1.0
* @example ````Click the button to animate the div with a number of different properties.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>animate demo</title>
<style>
div {
background-color: #bca;
width: 100px;
border: 1px solid green;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<button id="go">» Run</button>
<div id="block">Hello!</div>
<script>
// Using multiple unit types within one animation.
$( "#go" ).click(function() {
$( "#block" ).animate({
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, 1500 );
});
</script>
</body>
</html>
```
* @example ````Animates a div's left property with a relative value. Click several times on the buttons to see the relative animations queued up.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>animate demo</title>
<style>
div {
position: absolute;
background-color: #abc;
left: 50px;
width: 90px;
height: 90px;
margin: 5px;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<button id="left">«</button>
<button id="right">»</button>
<div class="block"></div>
<script>
$( "#right" ).click(function() {
$( ".block" ).animate({ "left": "+=50px" }, "slow" );
});
$( "#left" ).click(function(){
$( ".block" ).animate({ "left": "-=50px" }, "slow" );
});
</script>
</body>
</html>
```
* @example ````Animate all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.
```javascript
$( "p" ).animate({
height: "toggle",
opacity: "toggle"
}, "slow" );
```
* @example ````Animate all paragraphs to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds.
```javascript
$( "p" ).animate({
left: 50,
opacity: 1
}, 500 );
```
*/
animate(properties: JQuery.PlainObject,
duration_easing: JQuery.Duration | string,
complete?: (this: TElement) => void): this;
/**
* Perform a custom animation of a set of CSS properties.
* @param properties An object of CSS properties and values that the animation will move toward.
* @param options A map of additional options to pass to the method.
* @see \`{@link https://api.jquery.com/animate/ }\`
* @since 1.0
* @example ````The first button shows how an unqueued animation works. It expands the div out to 90% width while the font-size is increasing. Once the font-size change is complete, the border animation will begin.
The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>animate demo</title>
<style>
div {
background-color: #bca;
width: 200px;
height: 1.1em;
text-align: center;
border: 2px solid green;
margin: 3px;
font-size: 14px;
}
button {
font-size: 14px;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<button id="go1">» Animate Block1</button>
<button id="go2">» Animate Block2</button>
<button id="go3">» Animate Both</button>
<button id="go4">» Reset</button>
<div id="block1">Block1</div>
<div id="block2">Block2</div>
<script>
$( "#go1" ).click(function() {
$( "#block1" )
.animate({
width: "90%"
}, {
queue: false,
duration: 3000
})
.animate({ fontSize: "24px" }, 1500 )
.animate({ borderRightWidth: "15px" }, 1500 );
});
$( "#go2" ).click(function() {
$( "#block2" )
.animate({ width: "90%" }, 1000 )
.animate({ fontSize: "24px" }, 1000 )
.animate({ borderLeftWidth: "15px" }, 1000 );
});
$( "#go3" ).click(function() {
$( "#go1" ).add( "#go2" ).click();
});
$( "#go4" ).click(function() {
$( "div" ).css({
width: "",
fontSize: "",
borderWidth: ""
});
});
</script>
</body>
</html>
```
* @example ````Animates the first div's left property and synchronizes the remaining divs, using the step function to set their left properties at each stage of the animation.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>animate demo</title>
<style>
div {
position: relative;
background-color: #abc;
width: 40px;
height: 40px;
float: left;
margin: 5px;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p><button id="go">Run »</button></p>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<script>
$( "#go" ).click(function() {
$( ".block:first" ).animate({
left: 100
}, {
duration: 1000,
step: function( now, fx ){
$( ".block:gt(0)" ).css( "left", now );
}
});
});
</script>
</body>
</html>
```
* @example ````Animate the left and opacity style properties of all paragraphs; run the animation outside the queue, so that it will automatically start without waiting for its turn.
```javascript
$( "p" ).animate({
left: "50px",
opacity: 1
}, {
duration: 500,
queue: false
});
```
* @example ````Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.
```javascript
$( "p" ).animate({
height: "toggle",
opacity: "toggle"
}, {
duration: "slow"
});
```
* @example ````Use an easing function to provide a different style of animation. This will only work if you have a plugin that provides this easing function.
```javascript
$( "p" ).animate({
opacity: "show"
}, {
duration: "slow",
easing: "easein"
});
```
*/
animate(properties: JQuery.PlainObject,
options: JQuery.EffectsOptions<TElement>): this;
/**
* Perform a custom animation of a set of CSS properties.
* @param properties An object of CSS properties and values that the animation will move toward.
* @param complete A function to call once the animation is complete, called once per matched element.
* @see \`{@link https://api.jquery.com/animate/ }\`
* @since 1.0
*/
animate(properties: JQuery.PlainObject,
complete?: (this: TElement) => void): this;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
* jQuery objects to insert at the end of each element in the set of matched elements.
* @see \`{@link https://api.jquery.com/append/ }\`
* @since 1.0
* @example ````Appends some HTML to all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>append demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>I would like to say: </p>
<script>
$( "p" ).append( "<strong>Hello</strong>" );
</script>
</body>
</html>
```
* @example ````Appends an Element to all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>append demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<p>I would like to say: </p>
<script>
$( "p" ).append( document.createTextNode( "Hello" ) );
</script>
</body>
</html>
```
* @example ````Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>append demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
</head>
<body>
<strong>Hello world!!!</strong>
<p>I would like to say: </p>
<script>
$( "p" ).append( $( "strong" ) );
</script>
</body>
</html>
```
*/
append(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* @param funсtion A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at
* the end of each element in the set of matched elements. Receives the index position of the element
* in the set and the old HTML value of the element as arguments. Within the function, `this` refers to
* the current element in the set.
* @see \`{@link https://api.jquery.com/append/ }\`
* @since 1.4
*/