jQuery .toggle()模态显示/隐藏对话框

Bri*_*ian 3 javascript jquery toggle

我已经浏览了一些类似的问题 - 但我一直在寻找,并且没有运气找到与我正在寻找的实现相同的实现.

这非常简单:

<a class="contacttoggle" href="#">Contact</a>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div class="contact_box">Contact info that is initially hidden and then fades in when the "contact_toggle" Contact link above is clicked</div>
Run Code Online (Sandbox Code Playgroud)

我正在寻找这个淡入淡出它将绝对定​​位在页面上(不用担心我可以处理CSS).我只是想要幻灯片效果.刚刚淡入.

我觉得这个代码应该工作,但它不是:(

$(document).ready(function(){


    /* function to show and hide main navigation conatct box */
    $(".contact_box").hide();

    $('a.contacttoggle').click(function() { 
        $(this).next("div").find(".contact_box").toggle(400);
        return false;
    }); 


})
Run Code Online (Sandbox Code Playgroud)

Hao*_*chi 5

fadeToggle怎么样?