jQuery effects – slideDown(), slideUp(), slideToggle()

jQuery effects effects that can be added to parts of a web page using the jQuery library. These effects include slideDown(), slideUp(), slideToggle() and more.

Slide Effects

    • slideDown()
    • slideUp()
    • slideToggle()
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        *{
            margin: 0%;
            padding: 0%;
        }

        button{
            padding: 1%;
        }
        .head{

            width: 100%;
            height: 90px;
            background-color: slateblue;
        }
        h1{
            color: whitesmoke;
            padding: 2%;
        }
        .nav1{
            height: 90px;
            background-color: red;
            display: none;

        }

      

        ul{
            padding: 3%;
        }
        ul li{
            color: whitesmoke;
            display: inline;
            margin-left: 20px;
        }
    </style>
</head>
<body>


    <!-- Slideup-is used to slide up any object or element
    $(selector).slideUp(speed,callback); -->


    
    <!-- Slidedown-is used to slide down any object or element
    $(selector).slideDown(speed,callback); -->



        
    <!-- SlideToggle-is used to Toggle (both slide up and down at one time only) any object or element
    $(selector).slideToggle(speed,callback); -->


    <div class="head">
<h1><button class="slideup">slideUp</button><button class="slidedown">slideDown</button><button class="slidetoggle">slidetoggle</button>
    </div>



  

 

    <nav class="nav1">
        <ul>
            
            <li>home</li>
            <li>aboutus</li>
            <li>Contactus</li>
            <li>Blog</li>
            <li>Faq</li>
        
        </ul>
    </nav>

   
    
    
    <script src="jquery-3.6.0.min.js"></script>
    <script>

        $(document).ready(function(){


            $(".slideup").click(function(){

                $(".nav1").slideUp(1000)
            })


            

            $(".slidedown").click(function(){

$(".nav1").slideDown(1000)
})




$(".slidetoggle").click(function(){

$(".nav1").slideToggle(1000)
})


})
    </script>
</body>
</html>

 

Tags: slideDown(), slideUp(), slideToggle(),  jquery effects, jquery effects tutorials, jquery, jquery code snippets

MIT license