Hover Item with JQuery

前端 未结 4 1376
名媛妹妹
名媛妹妹 2020-12-06 19:04

Is there a way to hover an element using javascript? I don\'t want to create another class, I just want to cause element to hover with javascript when my mouse pointer is no

4条回答
  •  感情败类
    2020-12-06 19:53

    If I understand your question correctly, you've added a hover event using jQuery, and you'd like to trigger that event manually regardless of the mouse.

    If I understood correctly, you want to call the mouseenter to trigger the mouseenter event.

    If I've understood incorrectly, and you actually have a :hover CSS rule which you'd like to trigger using Javascript, that's not possible.
    Instead, you should add a class name to the rule (eg, something:hover, something.FakeHover { ... }), and add that class name using jQuery. (eg, $(...).addClass('FakeHover')).

提交回复
热议问题