当鼠标没有真正悬停时如何触发元素上的悬停功能 [英] How to trigger mouseover function on an element when not really mouseovered

查看:85
本文介绍了当鼠标没有真正悬停时如何触发元素上的悬停功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jQuery中,某个元素是否有可能像在页面加载时自动被鼠标悬停时(实际上没有被鼠标悬停时)一样工作?我的意思是,我不会将指针放在所需的元素上以使其执行我将放置的内容.

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 pointer on the desired element for it to do what it would do if I put.

推荐答案

使用 .trigger()触发事件.

$('#foo').trigger('mouseover');

这篇关于当鼠标没有真正悬停时如何触发元素上的悬停功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆