left 메뉴 고정

left 메뉴 고정

QA

left 메뉴 고정

본문

안녕하세요! 지금 left 메뉴 소스가 호버 시에만 하위 메뉴들이 내려옵니다~

하위 메뉴들이 내려왔을 때 메뉴를 클릭해서 페이지를 이동하면

그 페이지에 해당하는 하위 메뉴가 내려와 있는 상태로 고정되어 있게 바꾸고 싶은데요.

좋은 방법 있을까요?

 


<script type="text/javascript" language="javascript" src="../js/jquery_left.js"></script>
    <script type="text/javascript">
$(document).ready(function()
{
    //slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
    $("#firstpane p.menu_head").click(function()
    {
        $(this)//.css({backgroundImage:"url(<?php echo G5_THEME_URL ?>/img/sub/down.png)"})
            .next("div.menu_body").slideToggle(100).siblings("div.menu_body").slideUp("slow");
           $(this).siblings()//.css({backgroundImage:"url(<?php echo G5_THEME_URL ?>/img/sub/left.png)"});
    });
    //slides the element with class "menu_body" when mouse is over the paragraph
    $("#secondpane p.menu_head").mouseover(function()
    {
         $(this)//.css({backgroundImage:"url(<?php echo G5_THEME_URL ?>/img/sub/down.png)"})
             .next("div.menu_body").slideDown(200).siblings("div.menu_body").slideUp("slow");
         $(this).siblings()//.css({backgroundImage:"url(<?php echo G5_THEME_URL ?>/img/sub/left.png)"});
    });
});
</script>
<style type="text/css">
.menu_list {    
    width: 200px;
    margin-top:30px;
    font-size:15px;
}
.menu_head {
    cursor: pointer;
    position: relative;
    margin:1px;
    border-bottom:1px solid #e1e1e1;
    /* font-weight:bold; */
    background: #fff url('<?php echo G5_THEME_URL ?>/img/sub/left.png') center right no-repeat;
}
.menu_head:hover {background-color:#004083; color:white;}
.menu_head a:hover { color:white; }
.menu_body {
    display:none;
}
.menu_body a{
  display:block;
  color:#006699;
  background-color:#EFEFEF;
  padding:10px 10px;
  /* font-weight:bold; */
  text-decoration:none;
  padding-left:22px;
}
.menu_body a:hover{
  color: #000000;
  text-decoration:underline;
  }
</style>
<script>
    // html dom 이 다 로딩된 후 실행된다.
    $(document).ready(function(){
        // menu 클래스 바로 하위에 있는 a 태그를 클릭했을때
        $(".menu>a").hover(function(){
            var submenu = $(this).next("ul");
 
            // submenu 가 화면상에 보일때는 위로 보드랍게 접고 아니면 아래로 보드랍게 펼치기
            if( submenu.is(":visible") ){
                submenu.slideUp();
            }else{
                submenu.slideDown();
            }
        });
    });
</script>

이 질문에 댓글 쓰기 :

답변 1

document.ready(function() 에서

활성화된 페이지를 구분할 수 있는 값을 가져와서 조건문을 추가해 slideDown()을 호출하면 될것같습니다.

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

회원로그인

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