-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.1.4.2.sdocml
9332 lines (8281 loc) · 348 KB
/
jquery.1.4.2.sdocml
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
<?xml version="1.0"?>
<!-- Aptana Studio support for the jQuery 1.4.2 JavaScript Libary -->
<javascript>
<aliases>
<alias name="$" type="jQuery" />
</aliases>
<class type="jQuery">
<constructors>
<constructor scope="">
<description>&lt;p&gt;You can pass in plain HTML Strings written by hand, create them using some template engine or plugin, or load them via AJAX. When creating single elements use the closing tag or XHTML format. For example, to create a span use $("&lt;span/&gt;"). As of jQuery 1.3 this syntax is completely equivalent to $(document.createElement("span")).&lt;/p&gt;</description>
<parameters>
<parameter name="html" usage="required" type="String">
<description>A string of HTML to create on the fly.</description>
</parameter>
<parameter name="ownerDocument" usage="optional" type="document">
<description>A document in which the new elements will be created</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Creates a div element (and all of its contents) dynamically, and appends it to the body element. Internally, an element is created and its innerHTML property set to the given markup. It is therefore both quite flexible and limited.
</p>
<pre>
$("&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;").appendTo("body")
</pre>
</example>
</examples>
</constructor>
<constructor scope="">
<description>This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements).</description>
<parameters>
<parameter name="elements" usage="required" type="Element, Array<Element>">
<description>DOM element(s) to be encapsulated by a jQuery object.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Sets the background color of the page to black.
</p>
<pre>
$(document.body).css( "background", "black" );
</pre>
</example>
<example>
<p>
Hides all the input elements within a form.
</p>
<pre>
$(myForm.elements).hide()
</pre>
</example>
</examples>
</constructor>
<constructor scope="">
<description>Allows you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready to be operated on. While this function is, technically, chainable - there really isn't much use for chaining against it.
You can have as many $(document).ready events on your page as you like.
See ready(Function) for details about the ready event. </description>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute when the DOM is ready.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Executes the function when the DOM is ready to be used.
</p>
<pre>
$(function(){
// Document is ready
});
</pre>
</example>
<example>
<p>
Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.
</p>
<pre>
jQuery(function($) {
// Your code using failsafe $ alias here...
});
</pre>
</example>
</examples>
</constructor>
<constructor scope="">
<description>The core functionality of jQuery centers around this function. Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS), which then finds all matching elements.
By default, if no context is specified, $() looks for DOM elements within the context of the current HTML document. If you do specify a context, such as a DOM element or jQuery object, the expression will be matched against the contents of that context.
See &lt;a href='Selectors'&gt;Selectors&lt;/a&gt; for the allowed CSS syntax for expressions. </description>
<parameters>
<parameter name="expression" usage="required" type="String">
<description>An expression to search with.</description>
</parameter>
<parameter name="context" usage="optional" type="Element, jQuery">
<description>A DOM Element, Document or jQuery to use as context</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Finds all p elements that are children of a div element.
</p>
<pre>
$("div &gt; p").css("border", "1px solid gray");
</pre>
<pre>
&lt;p&gt;one&lt;/p&gt; &lt;div&gt;&lt;p&gt;two&lt;/p&gt;&lt;/div&gt; &lt;p&gt;three&lt;/p&gt;
</pre>
</example>
<example>
<p>
Finds all inputs of type radio within the first form in the document.
</p>
<pre>
$("input:radio", document.forms[0]);
</pre>
</example>
<example>
<p>
Finds all div elements within an XML document from an AJAX response.
</p>
<pre>
$("div", xml.responseXML);
</pre>
</example>
</examples>
</constructor>
</constructors>
<properties>
<property name="context" type="Element" scope="instance">
<description>&lt;p&gt;Should be used in conjunction with selector to determine the exact query used. These two properties are mostly useful to plugin developers.&lt;/p&gt;</description>
<examples>
<example>
<p>
Determine the exact context used.
</p>
<pre>
$("ul")
.append("&lt;li&gt;" + $("ul").context + "&lt;/li&gt;")
.append("&lt;li&gt;" + $("ul", document.body).context.nodeName + "&lt;/li&gt;");
</pre>
<pre>
Context:&lt;ul&gt;&lt;/ul&gt;
</pre>
</example>
</examples>
</property>
<property name="jQuery.boxModel" type="Boolean" scope="static">
<description/>
<examples>
<example>
<p>
Returns the box model for the iframe.
</p>
<pre>
$("p").html("The box model for this iframe is: &lt;span&gt;" +
jQuery.boxModel + "&lt;/span&gt;");
</pre>
<pre>
&lt;p&gt;
&lt;/p&gt;
</pre>
</example>
<example>
<p>
Returns false if the page is in QuirksMode in Internet Explorer
</p>
<pre>
$.boxModel
</pre>
</example>
</examples>
</property>
<property name="jQuery.browser" type="Map" scope="static">
<description>Available flags are:
* safari
* opera
* msie
* mozilla
This property is available before the DOM is ready, therefore you can use it to add ready events only for certain browsers.
There are situations where object detection is not reliable enough, in such cases it makes sense to use browser detection.
A combination of browser and object detection yields quite reliable results. </description>
<examples>
<example>
<p>
Show the browser info.
</p>
<pre>
jQuery.each(jQuery.browser, function(i, val) {
$("&lt;div&gt;" + i + " : &lt;span&gt;" + val + "&lt;/span&gt;")
.appendTo(document.body);
});
</pre>
<pre>
&lt;p&gt;Browser info:&lt;/p&gt;
</pre>
</example>
<example>
<p>
Returns true if the current useragent is some version of Microsoft's Internet Explorer.
</p>
<pre>
$.browser.msie
</pre>
</example>
<example>
<p>
Alerts "this is safari!" only for safari browsers
</p>
<pre>
if ($.browser.safari) {
alert("this is safari!");
}
</pre>
</example>
<example>
<p>
Alerts "Do stuff for firefox 3" only for firefox 3 browsers.
</p>
<pre>
jQuery.each(jQuery.browser, function(i, val) {
if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.9")
alert("Do stuff for firefox 3")
});
</pre>
</example>
<example>
<p>
Set a CSS property to specific browser.
</p>
<pre>
jQuery.each(jQuery.browser, function(i) {
if($.browser.msie){
$("#div ul li").css("display","inline");
}else{
$("#div ul li").css("display","inline-table");
}
});
</pre>
</example>
</examples>
</property>
<property name="jQuery.browser.version" type="String" scope="static">
<description>Here are some typical results:
* Internet Explorer: 6.0, 7.0
* Mozilla/Firefox/Flock/Camino: 1.7.12, 1.8.1.3, 1.9
* Opera: 9.20
* Safari/Webkit: 312.8, 418.9</description>
<examples>
<example>
<p>
Returns the browser version.
</p>
<pre>
$("p").html("The browser version is: &lt;span&gt;" +
jQuery.browser.version + "&lt;/span&gt;");
</pre>
<pre>
&lt;p&gt;
&lt;/p&gt;
</pre>
</example>
<example>
<p>
Alerts the version of IE that is being used
</p>
<pre>
if ( $.browser.msie )
alert( $.browser.version );
}
</pre>
</example>
<example>
<p>
Often you only care about the "major number," the whole number. This can be accomplished with JavaScript's built-in parseInt() function:
</p>
<pre>
if (jQuery.browser.msie) {
alert(parseInt(jQuery.browser.version));
}
</pre>
</example>
</examples>
</property>
<property name="jQuery.fx.off" type="Boolean" scope="static">
<description>&lt;p&gt;Setting this property to true will disable all animations from occurring (the effect will happen instantaneously, instead). This may be desirable for a couple reasons:&lt;/p&gt;
# You're using jQuery on a low-resource device.
# Some of your users are encountering [http://www.jdeegan.phlegethon.org/turn_off_animation.html accessibility problems] with the animations.
&lt;p&gt;Animations can be turned back on by setting the property to false.&lt;/p&gt;</description>
<examples>
<example>
<p>
Run a disabled animation
</p>
<pre>
jQuery.fx.off = true;
$("input").click(function(){
$("div").toggle("slow");
});
</pre>
<pre>
&lt;input type="button" value="Run"/&gt;&lt;div&gt;&lt;/div&gt;
</pre>
</example>
</examples>
</property>
<property name="jQuery.support" type="Object" scope="static">
<description>&lt;p&gt;jQuery comes with a number of properties included, you should feel free to add your own. Many of these properties are rather low-level so it's doubtful that they'll be useful in general day-to-day development, but mostly used by plugin and core developers.&lt;/p&gt;
&lt;p&gt;The values of all the support properties are determined using feature detection (and do not use any form of browser sniffing). There are some excellent resources that explain how feature detection works:&lt;/p&gt;
* http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
* http://yura.thinkweb2.com/cft/
* http://www.jibbering.com/faq/faq_notes/not_browser_detect.html
&lt;p&gt;The tests included in jQuery.support are as follows:&lt;/p&gt;
* '''boxModel''': Is equal to true if the page and browser are rendering according to the [http://www.w3.org/TR/REC-CSS2/box.html W3C CSS Box Model] (is currently false in IE 6 and 7 when they are in Quirks Mode). This property is null until document ready occurs.
* '''cssFloat''': Is equal to true if style.cssFloat is used to access the current CSS float value (is currently false in IE, it uses styleFloat instead).
* '''hrefNormalized''': Is equal to true if the browser leaves intact the results from getAttribute("href")(is currently false in IE, the URLs are normalized).
* '''htmlSerialize''': Is equal to true if the browser properly serializes link elements when innerHTML is used (is currently false in IE).
* '''leadingWhitespace''': Is equal to true if the browser preserves leading whitespace when innerHTML is used (is currently false in IE 6-8).
* '''noCloneEvent''': Is equal to true if the browser does not clone event handlers when elements are cloned (is currently false in IE).
* '''objectAll''': Is equal to true if doing getElementsByTagName("*") on an object element returns all descendant elements (is currently false in IE 7).
* '''opacity''': Is equal to true if a browser can properly interpret the opacity style property (is currently false in IE, it uses alpha filters instead).
* '''scriptEval''': Is equal to true if using appendChild/createTextNode to inject inline scripts executes them (is currently false in IE, it uses .text to insert executable scripts).
* '''style''': Is equal to true if getAttribute("style") is able to return the inline style specified by an element (is currently false in IE - it uses cssText instead).
* '''tbody''': Is equal to true if the browser allows table elements without tbody elements (is currently false in IE, which automatically inserts tbody if it is not present).</description>
<examples>
<example>
<p>
Returns the box model for the iframe.
</p>
<pre>
$("p").html("This frame uses the W3C box model: &lt;span&gt;" +
jQuery.support.boxModel + "&lt;/span&gt;");
</pre>
<pre>
&lt;p&gt;
&lt;/p&gt;
</pre>
</example>
<example>
<p>
Returns false if the page is in QuirksMode in Internet Explorer
</p>
<pre>
jQuery.support.boxModel
</pre>
</example>
</examples>
</property>
<property name="length" type="Number" scope="instance">
<description>The number of elements currently matched. The &lt;a href='Core/size'&gt;size&lt;/a&gt; function will return the same value.</description>
<examples>
<example>
<p>
Count the divs. Click to add more.
</p>
<pre>
$(document.body).click(function () {
$(document.body).append($("&lt;div&gt;"));
var n = $("div").length;
$("span").text("There are " + n + " divs." +
"Click to add more.");
}).trigger('click'); // trigger the click to start
</pre>
<pre>
&lt;span&gt;&lt;/span&gt;
&lt;div&gt;&lt;/div&gt;
</pre>
</example>
</examples>
</property>
<property name="selector" type="String" scope="instance">
<description>&lt;p&gt;Should be used in conjunction with context to determine the exact query used. These two properties are mostly useful to plugin developers.&lt;/p&gt;</description>
<examples>
<example>
<p>
Determine the selector used.
</p>
<pre>
$("ul")
.append("&lt;li&gt;" + $("ul").selector + "&lt;/li&gt;")
.append("&lt;li&gt;" + $("ul li").selector + "&lt;/li&gt;")
.append("&lt;li&gt;" + $("div#foo ul:not([class])").selector + "&lt;/li&gt;");
</pre>
<pre>
Some selectors:&lt;ul&gt;&lt;/ul&gt;
</pre>
</example>
</examples>
</property>
</properties>
<methods>
<method name="add" scope="instance">
<description/>
<parameters>
<parameter name="expr" usage="required" type="String, DOMElement, Array<DOMElement>">
<description>An expression whose matched elements are added for String, a string of HTML to create on the fly for DOMElement or one or more Elements to add if an Array.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Finds all divs and makes a border. Then adds all paragraphs to the jQuery object to set their backgrounds yellow.
</p>
<pre>
$("div").css("border", "2px solid red")
.add("p")
.css("background", "yellow");
</pre>
<pre>
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;Added this... (notice no border)&lt;/p&gt;
</pre>
</example>
<example>
<p>
Adds more elements, matched by the given expression, to the set of matched elements.
</p>
<pre>
$("p").add("span").css("background", "yellow");
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;&lt;span&gt;Hello Again&lt;/span&gt;
</pre>
</example>
<example>
<p>
Adds more elements, created on the fly, to the set of matched elements.
</p>
<pre>
$("p").clone().add("&lt;span&gt;Again&lt;/span&gt;").appendTo(document.body);
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;
</pre>
</example>
<example>
<p>
Adds one or more Elements to the set of matched elements.
</p>
<pre>
$("p").add(document.getElementById("a")).css("background", "yellow");
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;&lt;span id="a"&gt;Hello Again&lt;/span&gt;
</pre>
</example>
<example>
<p>
Demonstrates how to add (or push) elements to an existing collection
</p>
<pre>
var collection = $("p");
// capture the new collection
collection = collection.add(document.getElementById("a"));
collection.css("background", "yellow");
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;&lt;span id="a"&gt;Hello Again&lt;/span&gt;
</pre>
</example>
</examples>
</method>
<method name="addClass" scope="instance">
<description/>
<parameters>
<parameter name="class" usage="required" type="String">
<description>One or more classes to add to the elements, these are separated by spaces.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Adds the class 'selected' to the matched elements.
</p>
<pre>
$("p:last").addClass("selected");
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;Goodbye&lt;/p&gt;
</pre>
</example>
<example>
<p>
Adds the classes 'selected' and 'highlight' to the matched elements.
</p>
<pre>
$("p:last").addClass("selected highlight");
</pre>
<pre>
&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;Goodbye&lt;/p&gt;
</pre>
</example>
</examples>
</method>
<method name="after" scope="instance">
<description/>
<parameters>
<parameter name="content" usage="required" type="String, Element, jQuery">
<description>Content to insert after each target.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Inserts some HTML after all paragraphs.
</p>
<pre>
$("p").after("&lt;b&gt;Hello&lt;/b&gt;");
</pre>
<pre>
&lt;p&gt;I would like to say: &lt;/p&gt;
</pre>
</example>
<example>
<p>
Inserts a DOM element after all paragraphs.
</p>
<pre>
$("p").after( document.createTextNode("Hello") );
</pre>
<pre>
&lt;p&gt;I would like to say: &lt;/p&gt;
</pre>
</example>
<example>
<p>
Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.
</p>
<pre>
$("p").after( $("b") );
</pre>
<pre>
&lt;b&gt;Hello&lt;/b&gt;
&lt;p&gt;I would like to say: &lt;/p&gt;
</pre>
</example>
</examples>
</method>
<method name="ajaxComplete" scope="instance">
<description>The XMLHttpRequest and settings used for that request are passed as arguments to the callback.</description>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Show a message when an AJAX request completes.
</p>
<pre>
$("#msg").ajaxComplete(function(request, settings){
$(this).append("&lt;li&gt;Request Complete.&lt;/li&gt;");
});
</pre>
</example>
</examples>
</method>
<method name="ajaxError" scope="instance">
<description>The XMLHttpRequest and settings used for that request are passed as arguments to the callback. A third argument, an exception object, is passed if an exception occured while processing the request.</description>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions, thrownError) {
// thrownError only passed if an error was caught
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Show a message when an AJAX request fails.
</p>
<pre>
$("#msg").ajaxError(function(event, request, settings){
$(this).append("&lt;li&gt;Error requesting page " + settings.url + "&lt;/li&gt;");
});
</pre>
</example>
</examples>
</method>
<method name="ajaxSend" scope="instance">
<description>The XMLHttpRequest and settings used for that request are passed as arguments to the callback.</description>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Show a message before an AJAX request is sent.
</p>
<pre>
$("#msg").ajaxSend(function(evt, request, settings){
$(this).append("&lt;li&gt;Starting request at " + settings.url + "&lt;/li&gt;");
});
</pre>
</example>
</examples>
</method>
<method name="ajaxStart" scope="instance">
<description/>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function () {
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Show a loading message whenever an AJAX request starts (and none is already active).
</p>
<pre>
$("#loading").ajaxStart(function(){
$(this).show();
});
</pre>
</example>
</examples>
</method>
<method name="ajaxStop" scope="instance">
<description/>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function () {
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Hide a loading message after all the AJAX requests have stopped.
</p>
<pre>
$("#loading").ajaxStop(function(){
$(this).hide();
});
</pre>
</example>
</examples>
</method>
<method name="ajaxSuccess" scope="instance">
<description>The event object, XMLHttpRequest, and settings used for that request are passed as arguments to the callback.</description>
<parameters>
<parameter name="callback" usage="required" type="Function">
<description>The function to execute.
&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
this; // dom element listening
}
&lt;/pre&gt;</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Show a message when an AJAX request completes successfully.
</p>
<pre>
$("#msg").ajaxSuccess(function(evt, request, settings){
$(this).append("&lt;li&gt;Successful Request!&lt;/li&gt;");
});
</pre>
</example>
</examples>
</method>
<method name="andSelf" scope="instance">
<description>Useful for traversing elements, and then adding something that was matched before the last traversal.</description>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Find all divs, and all the paragraphs inside of them, and give them both classnames. Notice the div doesn't have the yellow background color since it didn't use andSelf().
</p>
<pre>
$("div").find("p").andSelf().addClass("border");
$("div").find("p").addClass("background");
</pre>
<pre>
&lt;div&gt;
&lt;p&gt;First Paragraph&lt;/p&gt;
&lt;p&gt;Second Paragraph&lt;/p&gt;
&lt;/div&gt;
</pre>
</example>
</examples>
</method>
<method name="animate" scope="instance">
<description>The key aspect of this function is the object of style properties that will be animated, and to what end. Each key within the object represents a style property that will also be animated (e.g. "height", "top", or "opacity").
Note that properties should be specified using camel case, e.g. "marginLeft" instead of "margin-left."
The value associated with the key represents to what end the property will be animated. If a number is provided as the value, then the style property will be transitioned from its current state to that new number. Otherwise if the string "hide", "show", or "toggle" is provided, a default animation will be constructed for that property. </description>
<parameters>
<parameter name="params" usage="required" type="Options">
<description>A set of style attributes that you wish to animate, and to what end.</description>
</parameter>
<parameter name="options" usage="required" type="Options">
<description>A set of options with which to configure the animation.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
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.
</p>
<pre>
$("#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:""});
});
</pre>
<pre>
&lt;button id="go1"&gt;&raquo; Animate Block1&lt;/button&gt;
&lt;button id="go2"&gt;&raquo; Animate Block2&lt;/button&gt;
&lt;button id="go3"&gt;&raquo; Animate Both&lt;/button&gt;
&lt;button id="go4"&gt;&raquo; Reset&lt;/button&gt;
&lt;div id="block1"&gt;Block1&lt;/div&gt;
&lt;div id="block2"&gt;Block2&lt;/div&gt;
</pre>
</example>
<example>
<p>
Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.
</p>
<pre>
$("p").animate({
"height": "toggle", "opacity": "toggle"
}, { duration: "slow" });
</pre>
</example>
<example>
<p>
Animates all paragraph to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds. It also will do it ''outside'' the queue, meaning it will automatically start without waiting for its turn.
</p>
<pre>
$("p").animate({
left: "50px", opacity: 1
}, { duration: 500, queue: false });
</pre>
</example>
<example>
<p>
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.
</p>
<pre>
$("p").animate({
"opacity": "show"
}, { "duration": "slow", "easing": "easein" });
</pre>
</example>
<example>
<p>
An example of using a callback function. The first argument is an array 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.
</p>
<pre>
$("p").animate({
height:200, width:400, opacity: .5
}, 1000, "linear", function(){alert("all done");} );
</pre>
</example>
</examples>
</method>
<method name="animate" scope="instance">
<description>The key aspect of this function is the object of style properties that will be animated, and to what end. Each key within the object represents a style property that will also be animated (for example: "height", "top", or "opacity").
Note that properties should be specified using camel case, e.g. "marginLeft" instead of "margin-left."
The value associated with the key represents to what end the property will be animated. If a number is provided as the value, then the style property will be transitioned from its current state to that new number. Otherwise if the string "hide", "show", or "toggle" is provided, a default animation will be constructed for that property. Only properties that take numeric values are supported (e.g. backgroundColor is not supported).
&lt;p&gt;As of jQuery 1.2 you can now animate properties by em and % (where applicable). Additionally, in jQuery 1.2, you can now do relative animations - specifying a "''+=''" or "''-=''" in front of the property value moves the element positively or negatively, relative to its current position.&lt;/p&gt;
&lt;p&gt;As of jQuery 1.3 if you specify an animation duration of 0 then the animation will synchronously set the elements to their end state (this is different from old versions where there would be a brief, asynchronous, delay before the end state would be set).&lt;/p&gt;</description>
<parameters>
<parameter name="params" usage="required" type="Options">
<description>A set of style attributes that you wish to animate, and to what end.</description>
</parameter>
<parameter name="duration" usage="optional" type="String, Number">
<description>A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).</description>
</parameter>
<parameter name="easing" usage="optional" type="String">
<description>The name of the easing effect that you want to use (plugin required). There are two built-in values, "linear" and "swing".</description>
</parameter>
<parameter name="callback" usage="optional" type="Function">
<description>A function to be executed whenever the animation completes, executes once for each element animated against.</description>
</parameter>
</parameters>
<return-types>
<return-type type="jQuery"/>
</return-types>
<examples>
<example>
<p>
Click the button to animate the div with a number of different properties.
</p>
<pre>
// 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 );
});
</pre>