Simulate hover using JavaScript events

前端 未结 4 1826
渐次进展
渐次进展 2021-01-05 22:26

Is it possible to simulate hover using JavaScript Events? I tried injecting mouseover event on the target element but no luck.

For example, if there is a link that

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 23:16

    The jQuery hover event is just using mouseenter and mouseleave events. Here is the source of jQuery's hover:

    function (fnOver, fnOut) {
        return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
    }
    

提交回复
热议问题