How to create sliding DIV on click?

后端 未结 6 1812
礼貌的吻别
礼貌的吻别 2021-01-04 06:03

I am looking to create a slide out DIV, like the one here when you press \"Contact\". Does anybody know of anything similar to this?

6条回答
  •  离开以前
    2021-01-04 06:35

    Making use jQuery's slideToggle() method could help you do this.

    Example

    HTML:

    Contact me!
    Contact

    CSS:

    #contact
    {
        display: none;
        background: grey;
        color: #FFF;
        padding: 10px;
    }
    

    JavaScript:

    $(function()
    {
         $("a#toggle").click(function()
         {
             $("#contact").slideToggle();
             return false;
         }); 
    });
    

提交回复
热议问题