---
title: "jquery check display block"
author: "fancyboy2050"
date: "2011-11-10T12:00:13Z"
tags: ["js jquery"]
categories: ["互联网"]
slug: "jquery-check-display-block"
draft: false
lastmod: "2011-11-10T12:00:13Z"
id: 1250081
url: "https://fancyboy2050.iteye.com/blog/1250081"
---

```js

$(this).closest(".list_head").next(".list_con").toggle();
toggle()：切换元素可见状态
if($(this).closest(".list_head").next(".list_con").is(':visible')){
    $(this).closest(".list").addClass("list_now");
} else {
    $(this).closest(".list").removeClass("list_now")
}
.is(':visible')：检测元素是否可见

```