Javascript onHover event

前端 未结 4 733
无人及你
无人及你 2020-11-29 02:49

Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if

4条回答
  •  情话喂你
    2020-11-29 03:38

    If you use the JQuery library you can use the .hover() event which merges the mouseover and mouseout event and helps you with the timing and child elements:

    $(this).hover(function(){},function(){});
    

    The first function is the start of the hover and the next is the end. Read more at: http://docs.jquery.com/Events/hover

提交回复
热议问题