悬停的Jquery(当我们悬停的元素上方有一个元素时) [英] Jquery on hover (when there is an element above the element we're hovering)

查看:68
本文介绍了悬停的Jquery(当我们悬停的元素上方有一个元素时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以在彼此之上有两个元素。当元素(位于顶部的元素下方)被徘徊时,我该如何调用函数?

非常感谢,我真的需要这个工作:s

解决方案

您可以使用CSS 指针事件 属性:


除了指示元素不是鼠标事件的目标外,值none指示鼠标事件穿过元素,并指向该元素下面的任何内容。




  #top {
pointer-events:none;


$('#underneath')。hover(function(){
....
})


So there are two elements on top of eachother. How do i call a function as soon as the element (under the one on top) is hovered?

Thanks alot, I really need this to work :s

解决方案

You can use CSS pointer-events property:

In addition to indicating that the element is not the target of mouse events, the value none instructs the mouse event to go "through" the element and target whatever is "underneath" that element instead.

#top {
   pointer-events: none;
}

$('#underneath').hover(function(){
     ....  
})

这篇关于悬停的Jquery(当我们悬停的元素上方有一个元素时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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