How to trigger mouseover function on an element when not really mouseovered

后端 未结 3 574
别那么骄傲
别那么骄傲 2020-12-07 01:56

In jQuery, is it possible for an element to act like it is mouseovered automatically when the page is loading, when it is not really mouseovered? I mean, I won\'t put my poi

相关标签:
3条回答
  • 2020-12-07 02:03

    Use .trigger() to trigger an event.

    $('#foo').trigger('mouseover');
    
    0 讨论(0)
  • 2020-12-07 02:07

    You can call the handler directly

    $('abc').mouseover();
    
    0 讨论(0)
  • 2020-12-07 02:08

    Put the desired action in the document.ready function as that is when you actually want the action, not on a mouse-over that doesn't happen.

    0 讨论(0)
提交回复
热议问题