使用类似$(“。someClass”)的JQuery确定元素集合是否可见
16lz
2021-01-22
I have a collection of elements on my page, and I want to see if they are visible or not currently.
我的页面上有一系列元素,我想看看它们当前是否可见。
So:
$(".someClass")
How can I loop through and figure this out? because if it is visible, i have to fire another function.
我怎样才能循环并弄清楚这一点?因为如果它是可见的,我必须发射另一个功能。
4 个解决方案
#1
$(".someClass").each(function(){
if($(this).is(":visible")){
//item is visible: do something
}
});
how about that?
那个怎么样?
更多相关文章
- 创建一个未排序的数组,其中包含重复元素和唯一元素的总和
- jQuery在元素内部检测mousedown,然后在元素外部进行mouseup
- 如何在angularjs代码中单元测试jquery元素
- jquery1.9+获取append后的动态元素
- Jquery | 基础 | 慕课网 | 元素选择器
- 如何知道DOM元素何时移动或调整大小
- 删除使用jQuery动态创建的元素
- 如何在jQuery中选择最后一个子元素?
- JQuery 的选取元素 和 方法