可能重复: 如何使用 jQuery 测试元素是否隐藏 在 jQuery 中,假设您有一个通过使用 .hide()、.show() 或 .toggle() 隐藏和显示的某种元素。如何测试该元素当前是否在屏幕上隐藏或可见?
请尝试$("some-selector").is(':hidden'); 或者$("some-selector").is(':visible'); 这里是 :visible 和 :hidden 选择器的文档。
$('.target').is(':hidden') // returns true if the element is hidden $('.target').is(':visible') // returns true if the element is visible