File size: 1,014 Bytes
55a09ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$(document).ready(function() {
    // Fade effect
    $("#fadeBtn").click(function() {
        $("#demoBox").fadeOut(500).fadeIn(500);
        $("#box1, #box2, #box3").fadeToggle(800);
    });

    // Slide effect
    $("#slideBtn").click(function() {
        $("#box1").slideUp(400).slideDown(400);
        $("#box2").slideToggle(600);
        $("#box3").animate({
            width: "toggle",
            height: "toggle"
        }, 600);
    });

    // Animation effect
    $("#animateBtn").click(function() {
        $("#demoBox").toggleClass("animated-box");
        $("#box1").animate({left: '+=50'}, 300);
        $("#box2").animate({top: '+=30'}, 300).animate({top: '-=30'}, 300);
        $("#box3").animate({width: '100px'}, 300).animate({width: '80px'}, 300);
    });

    // Add hover effects
    $("button").hover(
        function() {
            $(this).css('transform', 'translateY(-2px)');
        },
        function() {
            $(this).css('transform', 'translateY(0)');
        }
    );
});