这个问题是信息相关的。我是 jquery 的新手。我在 HTML 和 CSS 方面非常有经验。
Jquery 中的悬停和鼠标悬停有什么区别。 将鼠标悬停在元素上时,它们不是都被激活了吗。
最佳答案
mouseover():为该元素的子元素触发事件。
hover():悬停实际上可以与 mouseenter
和 mouseleave
配合使用,而不会触发子项。
要实现悬停效果,我们需要mouseover
和mouseout
事件
$("element").mousover(function(){
//do something over
}).mouseout(function() {
//do something out
});
而在 hover() 中它只是一个回调。
$("element").hover(
function () {
//do something enter
},
function () {
//do something exit
}
);
From David Jones's experience:
In the project I was working on I setup a container div to use mouseover and mouseout which added some html tabs to the container. This seemed perfectly fine but I discovered that using mouseover/mouseout meant the added html kept disappearing when I tried to interact with it along with the other jquery I had in place that was conflicting with it.
In the end my particular solution required me to use mouseenter and mouseleave with the live function rather than using hover because I was working with generated html.
关于jquery - Jquery 中的鼠标悬停与悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18060569/