jQuery study notes 2

1. CSS module

  * Style style

    * Css (styleName):  to obtain a corresponding value in accordance with the style name

    * Css (styleName, value):  Set a style

    * Css ({ plurality of styles }):  a plurality of styles

  *  Position coordinates

    * Offset ():  read / write current element coordinates ( origin is the top left corner of the page )

    * Position ():  read the current element coordinates ( origin is the top left corner of the parent element )

    * ScrollTop () / scrollLeft ()  : read / write element / scroll the page coordinates

  *  Dimensions

    * width()/height(): width/height

    * innerWidth()/innerHeight(): width + padding

    * outerWidth()/outerHeight(): width + padding + border

2.  Screening Module

  *  Filter

    *  In jQuery identify matching portions of the inner elements of the element object and packaged into new jQuery object returns

    * first()

    * last()

    * eq(index)

    * Filter (selector):  make demands of the current element

    * Not (selector):  make demands of the current element and negated

    * Has (selector):  make demands on the descendant elements

  *  Find

    *  Find jQuery elements inside the object sons / sibling / parent element and packaged into a new jQuery object returns

    * Children (selector):  sub-elements

    * Find (selector):  descendant elements

    * PreAll (selector):  before all brothers

    * Siblings (selector):  All Brothers

    * Parent ():  the parent element

3.  Document (CUD) module

  *  Increase

    * Append () / appendTo ()  : into the back

    * Preppend () / preppendTo ()  : insertion front

    * Before ():  into the front

    * After ():  into the back

  *  Delete

    * Remove ():  The inside of themselves and their children are deleted

    * Empty ():  emptied ( she is still )

  *  Updates

    * replaceWith()

  

4.  Events Module

  *  Binding Events

    * eventName(function(){})

    * on('eventName', function(){})

    * 常用: click, mouseenter/mouseleave mouseover/mouseout focus/blur

    * hover(function(){}, function(){})

  *  Unbundling event

    * off('eventName')

  *  Event delegation

    *  Understand the delegate event sub element to element processing fathers

      *  Event listener binding on the parent element but events on the sub-elements

      *  Event will bubble to the parent element

      *  However, the final event callback function is called sub-elements : event.target

    *  Benefits

      *  The new elements do not monitor events

      *  Reduce the number of listeners (n ==> 1)

    *  Coding

      * Delegate (selector, 'eventName'  , function (event) {}) // callback function of this is a child

      * undelegate('eventName')

  *  Event coordinates

     * Event.offsetX:  origin is the top left corner of the current element

     * Event.clientX:  origin is the top left corner of the window

     * Event.pageX:  origin is the top left corner of the page

  *  Event-related

    *  Stop event bubbling : event.stopPropagation ()

    *  Prevent the event's default behavior : event.preventDefault ()

Guess you like

Origin www.cnblogs.com/Jiang-jiang936098227/p/11605428.html