제이쿼리 질문합니다

제이쿼리 질문합니다

QA

제이쿼리 질문합니다

본문

 

<div id="hd_pop">

 

<div class="bg"></div>

 

<div class="hd_pops"></div>

<div class="hd_pops"></div> 

<div class="hd_pops"></div> 

 

</div>

 

#hd_pop 의 자식인 모든 .hd_pops 에 display:none 이있으면 .bg를 .hide() 시키고 싶습니다

 

if($("#hd_pop .hd_pops").css("display") == "none"){

$(".bg").hide() 

} 

 

이렇게 작성하면 첫번째 .hd_pops 가 display:none 이면 .bg가 hide되고 나머지는 display:none이든 뭐든 .bg가 hide가 안됩니다...

이 질문에 댓글 쓰기 :

답변 2

var flag = true;

$('.hd_pops').each( function() {

    if ($(this).css('display') == 'block') flag = false;

});

if (flag) $('.bg').hide();

var flag="N";

$("#hd_pop .hd_pops").each(function() {
    if($(this).css("display") == "none) flag="Y";
    

   });

 

if (flag=="Y") $(".bg").hide()  

답변을 작성하시기 전에 로그인 해주세요.
전체 133
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT