jquery - when to choose mouseover() and hover() function -


what differences between jquery .mouseover() , .hover() function? if totally same why jquery uses both?

from documentation

.mouseover(): source

bind event handler "mouseover" javascript event, or trigger event on element.

.hover(): source

bind 1 or 2 handlers matched elements, executed when mouse pointer enters , leaves elements.

calling $(selector).hover(handlerin, handlerout) shorthand for: $(selector).mouseenter(handlerin).mouseleave(handlerout);

.mouseenter(): source

bind event handler fired when mouse enters element, or trigger handler on element.

mouseover fires when pointer moves child element well, while mouseenter fires when pointer moves bound element.

what means

because of this, .mouseover() not same .hover(), same reason .mouseover() not same .mouseenter().

$('selector').mouseover(over_function) // may fire multiple times  // enter , exit functions called once per element per entry , exit $('selector').hover(enter_function, exit_function)  

Comments