jq event processing

Event binding:   

 .on()   

Note that the data format can also pass string is parsed into another format selector stores the e event source object data property of the event source object needs to obtain the data to be acquired e.data

The second example shows this parameter li realization event delegate to bind events of ul li li above so new entrants will also have the effect of events but if

Katsugaku use

In the multi-event binding mechanism for loop contains the following jq

 .one () method to bind event after the first click only have the effect of subsequent events will be lost

One-time event

jq cancel the default event not to consider the compatibility return false 

    .off () on the opposite event no parameters for unbundling will cancel all events custom event parameters may include transfer event type, event function name +

Note unbundling event should have been otherwise invalid parameter form is associated with an event

 .trigger () for system events trigger events can be custom event

Array parameter can be passed to the click event as a parameter to follow

   .click / keydown / mouseenter ... pay attention to the mouse wheel event mousewheel

 

is a function of two parameters .hover

 

Compatible event object:

   e.pageX, click position

e.clienX, click position

e.which、

e.button determine which mouse button

 e.preventDefault () to prevent the default event

 e.stopPropagation () to stop bubbling event

 return false; to prevent the default event

Published 56 original articles · won praise 1 · views 1204

Guess you like

Origin blog.csdn.net/qq_40819861/article/details/102564613