0

我需要在页面加载后立即隐藏“二和三”类,并且能够再次单击菜单以将其向下滑动,我遇到了以下代码的问题:

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

像这样试试 - 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 回答
1

这是jsfiddle http://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 回答