2012-12-16 1 views
0

페이지가로드되고 메뉴를 다시 클릭하여 아래로 슬라이드 할 수있게되는 즉시 '2 및 3'클래스가 숨겨져 있어야합니다. 다음 코드로 probles가 있습니다.jQuery slideUp 및 slideDwon 문제

$(document).ready(function() 
{ 

$('.two, .three').slideUp('slow'); 

$('.active_wrapper').click(function(){ 
    $('.two, .three').slideDown('slow'); 
}); 

}); 

HTML

<div class="nav_wrapper"> 

    <div class="active_wrapper one"><a class="active" href="">home</a></div> 

    <div class="two"><a href="about.html">about</a></div> 

    <div class="three"><a href="project.html">project</a></div> 

</div> 

답변

1

이런 식으로 시도 - 여기 DEMO

$(document).ready(function() 
{ 

$('.two, .three').slideUp('slow'); 

$('.active_wrapper').click(function(e){ 
    e.preventDefault(); 
    $('.two, .three').slideToggle('slow'); 
}); 

});​ 
1

CSS 표시 .two, .3에 전혀 제거 slideup와 jsfiddle http://jsfiddle.net/L6PkX/

사용은

<div class="nav_wrapper"> 

    <div class="active_wrapper one"><a class="active" href="#">home</a></div> 

    <div class="two"><a href="about.html">about</a></div> 

    <div class="three"><a href="project.html">project</a></div> 

</div> 

$(document).ready(function() 
{ 


$('.active_wrapper').click(function(){ 
    $('.two, .three').slideDown('slow'); 
}); 

}); 

.two, .three{ 
    display: none; 
}} 
관련 문제