• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>jQuery jQuery.fx</title>
7
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
8
    <style>
9
        #divBox {
10
            width: 100px;
11
            height: 100px;
12
            background-color: yellow;
13
            border: 5px solid red;
14
            margin-top: 20px;
15
        }
16
    </style>
17
    <script>
18
        $(function() {
19
            $("#toggleBtn").on("click", function() {
20
                // id가 "divBox"인 요소를 빠르게(0.2초에 걸쳐) 올라가면서 사라지거나 내려오면서 나타나게 함.
21
                $("#divBox").slideToggle("fast");
22
            });
23
            $("#setBtn").on("click", function() {
24
                // jQuery.fx 객체의 speeds 프로퍼티의 fast의 기본값을 1초로 변경함.
25
                jQuery.fx.speeds.fast = 1000;
26
            });
27
        });
28
    </script>
29
</head>
30
​
31
<body>
32
​
33
    <h1>jQuery.fx.speeds 프로퍼티</h1>
34
    <button id="toggleBtn">이펙트 효과 토글!</button>
35
    <button id="setBtn">이펙트 효과 속도 변경!</button>
36
    <div id="divBox"></div>
37
    
38
</body>
39
​
40
</html>