0

ページが読み込まれるとすぐにクラス「2と3」を非表示にし、メニューをもう一度クリックしてスライドダウンできるようにする必要があります。次のコードに問題があります。

$(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>
4

2 に答える 2

1

これがjsfiddlehttp : //jsfiddle.net/L6PkX/です。

cssで使用すると、.two、.threeでnoneを表示し、スライドアップを削除します

<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;
}}
于 2012-12-16T23:00:59.293 に答える
1

このようにしてみてください - DEMO

$(document).ready(function() 
{

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

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

});​
于 2012-12-16T22:58:59.400 に答える