《前端》loading案例一

界面一(彩色)

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>loading</title>
    <script src="//i2.wp.com/cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
    <style>
        #loading {
            background: #f3815e;
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 999;
        }
       
        .loadingImage {
            position: relative;
            width: 30px;
            height: 30px;
            background: #2e98df;
            border-radius: 50px;
            animation: loadingImage 1.5s infinite linear;
        }
       
        .loadingImage::after {
            position: absolute;
            width: 50px;
            height: 50px;
            border-top: 10px solid #b160d1;
            border-bottom: 10px solid #b160d1;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-radius: 50px;
            content: '';
            top: -20px;
            left: -20px;
            animation: loadingImage_after 1.5s infinite linear;
        }
       
        @keyframes loadingImage {
            0% {
                transform: rotate(0deg);
            }
            50% {
                transform: rotate(180deg);
                background: #2ecc71;
            }
            100% {
                transform: rotate(360deg);
            }
        }
       
        @keyframes loadingImage_after {
            0% {
                border-top: 10px solid #b160d1;
                border-bottom: 10px solid #b160d1;
            }
            50% {
                border-top: 10px solid #2e98df;
                border-bottom: 10px solid #2e98df;
            }
            100% {
                border-top: 10px solid #b160d1;
                border-bottom: 10px solid #b160d1;
            }
        }
    </style>
</head>

<body>
    <div id="loading">
        <div class="loadingImage"></div>
    </div>
    <h1>你好</h1>

    <script>
        $("#loading").fadeOut(400);
    </script>
</body>

</html>