계층형 슬라이드 질문입니다.

계층형 슬라이드 질문입니다.

QA

계층형 슬라이드 질문입니다.

본문

계층형 구조로 이루어진 슬라이드 쿼리에서

 

부모를 클릭시 자식을 나오게 하는 구성을 하고 있습니다.

 

하나하나 클릭 시에는 무리없이 슬라이드가 잘 되지만

 

부모의 부모를 클릭 할 시 부모의 자식도 없어저야 되지만 부모만 없어지고 부모의 자식은

없어지질 않습니다. 어떤식으로 연결을 해야 한꺼번에 없어질수 있는지 조언 부탁드립니다.

 

부모의 부모

              ㄴ 부모

                      ㄴ  자식                   ---> 부모의 부모 클릭시

 

 

부모의 부모

           ㄴ  자식                    ----> 이렇게 됨

 

 


 

이 질문에 댓글 쓰기 :

답변 1

처리방법이야 개발자의 마음대로 하겠지만

지금 소스코드 확인할 방법이 없으므로

저라면... 부모의부모 에서 하위 목록이 나올때는 div 로 묶어서 하위가 나오게 하고

일괄 닫기는 div 하나만 hide 시키면 될것으로 보여집니다.

<ul>

 echo "<a  target='iframe_show' id='latest_st' onclick='showRe(".$list[$i]['wr_id'].")'  href=\"".$list_href."\">";
           
    if($is_admin) {
    if(!$list[$i]['wr_reply'])
    echo "&nbsp;&nbsp;".$list[$i]['subject']."&nbsp;&nbsp;".$reply_cnt."<a target='iframe_show' class='first_re' href='".$reply_href."'>추가</a>";
} else {
if(!$list[$i]['wr_reply'])
    echo "&nbsp;&nbsp;".$list[$i]['subject'].$reply_cnt."";

}     
echo "</a>";
    ?>
        <li> 
            <?php
            //답변글만 출력
            if($is_admin){
            if($list[$i]['wr_reply']){
echo "<a target='iframe_show'  onclick='showRe(".$list[$i]['wr_id'].")' class='re".$list[$i]['wr_1']."' id='latest_re'  href=\"".$list[$i]['href']."\" >&nbsp;&nbsp;&nbsp;".$list[$i]['icon_reply']."&nbsp;&nbsp;";
            echo $list[$i]['subject']."&nbsp;&nbsp;".$reply_cnt_re."";
            echo "</a><a target='iframe_show' class='re".$list[$i]['wr_1']."' id='second_re' href='".$reply_href."'>추가</a>";
            }
            }
            else{
            if($list[$i]['wr_reply']){
            echo "<a target='iframe_show' onclick='showRe(".$list[$i]['wr_id'].")'  class='re".$list[$i]['wr_1']."'  id='latest_re'href=\"".$list[$i]['href']."\" >".$list[$i]['icon_reply']."&nbsp;&nbsp;";
            echo $list[$i]['subject']."&nbsp;&nbsp;".$reply_cnt_re."";
            echo "</a>";
            }
            }
            ?>
    </li>
</ul>

소스는 이런 상태입니다.

답변이 나오는 부분에만 div를 추가 시켜서 하면 될꺼같기는 한데
스크립트 부분에서 어떤식으로 조건을 줘야할지가..조금 답답하네여 ㅜㅜ

현재 스크립트는 간단하게 if문을 사용하지 않고 onclick을 이용하였기 때문에 toggle을 사용해서
소스를 짠 상태입니다.

 function showRe(no){
        $('.re'+no).slidetoggle('slow');
    }

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

회원로그인

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