Sunday, July 17, 2022

Jquery

<!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>practice</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
            $("#hide").click(function(){
                $("p").hide();
                $("#show").click(function(){
                    $("p").show();

                    $("#fdot").click(function(){
                        $("#box1").fadeOut();
                        $("#box2").fadeOut("slow");
                        $("#box3").fadeOut(2000);

                        $("#fdin").click(function(){
                            $("#box1").fadeIn();
                            $("#box2").fadeIn("slow");
                            $("#box3").fadeIn(2000);

                            $("#fdtg").click(function(){
                                $("#box1").fadeToggle();
                                $("#box2").fadeToggle("slow");
                                $("#box3").fadeToggle(2000);

                            $("#fdto").click(function(){
                                $("#box1").fadeTo("slow",0.15);
                                $("#box2").fadeTo("slow",0.4);
                                $("#box3").fadeTo("slow",0.7);

                                    $("#anm").click(function(){
                                        $("#box1").animate({left:'300px'});
                                        $("#box2").animate({left:'300px'});
                                        $("#box3").animate({left:'300px'});
                                    });
                            });
                            });
                        });
                    });
                });
            });
        });
    </script>
</head>
<body>
    <button id="hide">click to hide</button>
    <button id="show">click to show</button>
    <button id="fdot">fadeout</button>
    <button id="fdin">fadein</button>
    <button id="fdtg">fadetoggle</button>
    <button id="fdto">fadeto</button>
    <button id="anm">animate</button>
    <p>this is paragraph</p>
    <p>this is another paragraph</p>
    <div id="box1" style="height:80px; width:80px; background-color:red;
     margin-top:20px;position: relative;"></div>
    <div id="box2" style="height:80px; width:80px; background-color:green;
     margin-top:20px;position: relative;"></div>
    <div id="box3" style="height:80px; width:80px; background-color:blue;
     margin-top:20px;position: relative;"></div>
</body>
</html>

No comments:

Post a Comment