Official JQuery website
JQuery
JQuery is a js library that encapsulates some of our commonly used functions to facilitate our calls and improve development efficiency.
JQuery basic reference
1. Guide
2. Two Methods
$ (Document). ready (function (){})
$ (Function (){})
3. Use
Get event Source
Event
Event Handler
JQuery Selector
#,., Element ,*,,
Space,>, + ,~
: Eq (index),: lt (index),: gt (index),: first,: last,: even,: odd
[Attr], [attr = value], and [attr! = Value], [attr ^ = value], [attr $ = value], [attr * = value]
[Attr] [attr1]
. Eq (index),. parent (), children (), siblings (),. last (), first (), find ()
Conversion between DOM objects and JQuery objects
DOM-> JQuery objects: $ (document), $ (this)
JQuery-> DOM object: $ ("div") [0], $ ("div"). get (0)
. Eq (index)-Get the JQuery object
. Get (index)-obtained DOM object
JQuery chained Programming
JQuery Animation
1. Basic Animation
Show (speed, callback)
Hide (speed, callback)
2. sliding effect
Slideup (speed, callback)
Slidedown (speed, callback)
Slidetoggle (speed, callback)
3. fade in and out
FadeIn
FadeOut
FadeToggle
Fadeto (speed, opacity, fn)
Custom Animation
Animate (params, speed, easing, fn)
Stop Animation
Stop (clearQueue, gotoend) // If bool1 is true, terminate the animation immediately. Bool2 immediately finishes the animation being executed.
Style operations
1. addclass ("style name ")
2. Removeclass ("style name") // if there is no parameter, remove all styles
3. Toggleclass ("style name ")
4. Hasclass ("style name") // determines whether the style exists and returns the bool Value
Node operations
1. Insert nodes internally
Append () // Append later
AppentTo ()
Prepend () // insert forward
PrepentTo ()
2. Insert nodes externally
After () // Add a sibling Node
Insertafter () // append
Before () // Add a sibling Node
Insertbefore () // insert
3. delete a node
Remove () // Delete the selected Element
Empty () // clear the child element
4. Copy a node
Clone () // copy the node. If the parameter is true, the event will be copied.
5. Package nodes
Wrap (node) // a single package in node
WrapAll (node) // All packages in one node
6. Replace nodes
ReplaceWidth ()
Each (fn)
Each (function (index, element ){})