A, jQuery special attribute operations
val (): operation value attribute
html (): Get and set the content identification tag
text (): Get and set the contents without identification tag
width (): Get the current actual width of the div
innerWidth (): Get the current + div actual width of padding values
outWidth (): Get the current actual width div padding value + + border values: true when the parameter is to add the value of the margin
height (): Get the current actual height of div
innerHeight, ( ): Get the current actual width + div padding value
outHeight (): Get the current actual width div padding value + + border value: when the parameter to true plus the margin value is
scrollTop (): Get the height of the page is crimped
scrollLeft (): Get the width of the page to be crimped
Obtaining position of the element: Object object returns
offset (): Get the element with respect to the document's
position (): Get the position element is positioned relative to the parent element
Two, jQuery event mechanism
1, register an event
simple event: give yourself up event
jq objects .click (function () {
});
jq objects .bind ({
the Click: function () {},
MouseEnter: function () {},
});
Note that there is no event for more than two kinds of objects dynamically generated jq
Delegating events: the current element specified by the element to perform
delegate: delegate: dynamically created when there will be an event
to the parent element to register an event, the final sub-elements to perform
jq objects .delegate ( "selector", "event type", function () {});
the first parameter: What is the final event element to perform
the second argument: what event type
the third parameter: the function performed
registration on the event process:
first: to register themselves
jq target .on ( 'event name', function () {})
The second: trust: the child element at the event registration
jq objects .on ( 'event name', 'child element name', function () {})
Note: The first implementation of their the delegate event and then execute your own events
2, remove the event binding
jq objects .off (event name); does not pass the event argument is clear, if only to remove this event parameters
jq jq object calls another object's events: 1, jq objects .click () ; 2, jq objects .trigger ( 'event name')
3, the event object by reference
parameter passing on when the event registration: jq Object .on ( 'event name', Data, function (E) {var e.data} = A)
. 4, and to prevent blocking event bubbling default tag behavior
prevent the default behavior: jq target .on ( 'event name', data, function (e) {e.prevenDefault ()})
to prevent bubbling event: e.stopPropagation ()
return to false; can prevent the event from bubbling can be prevented The default behavior
Third, the program chain
provided operations: the chain can be programmed (target principle return jq)
Get operations: Chain not programmed (target return is not jq)
End () method: Returns the last target jq
Four function conflict $
$ .noConflict ();
Method a: jQuery after releasing the control by jQuery instead of $ $;
Method two: var variable = $ .noConflict (); This variable may alternatively $;