jquery check display block

$(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'):检测元素是否可见

猜你喜欢

转载自fancyboy2050.iteye.com/blog/1250081