add animation

This commit is contained in:
wolegca 2019-09-21 16:07:59 +08:00
parent e3bc023d61
commit 5aba679b90
7 changed files with 84 additions and 4 deletions

View File

@ -16,7 +16,7 @@ div.sidebar div:nth-of-type(n+1) span{
div.sidebar div:nth-of-type(n+1) a{ div.sidebar div:nth-of-type(n+1) a{
text-decoration: none; text-decoration: none;
transition:all ease .2s; transition:all ease .1s;
padding-left: 2px; padding-left: 2px;
border-radius:5px; border-radius:5px;
box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999;

View File

@ -8,6 +8,7 @@ body,
html { html {
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 100%;
} }
body { body {
@ -365,6 +366,64 @@ body {
margin-bottom: 10px margin-bottom: 10px
} }
.loading{
display: block;
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
width:100px;
height:100px;
z-index:100;
animation:fadeIn .2s ease .5s forwards;
opacity: 0;
}
.loading span{
display: block;
position: absolute;
top:0px;
left: 45px;
height:10px;
width:10px;
background:white;
border-radius: 10px;
transform-origin: 5px 50px;
animation: load 2s cubic-bezier(.6,0,.4,1) infinite;
}
.loading span:nth-of-type(1){
animation-delay: .125s
}
.loading span:nth-of-type(2){
animation-delay: .250s
}
.loading span:nth-of-type(3){
animation-delay: .375s
}
.loading span:nth-of-type(4){
animation-delay: .5s
}
.loading span:nth-of-type(5){
animation-delay: .625s
}
.loading span:nth-of-type(6){
animation-delay: .750s
}
@keyframes load {
0%{
transform:rotate(0deg)
}
50% {
transform:rotate(360deg);
}
100%{
transform:rotate(360deg);
}
}
@keyframes fadeIn { @keyframes fadeIn {
from { from {
opacity: 0 opacity: 0

View File

@ -43,7 +43,14 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="mask"></div> --> <div class="loading">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="js/drag.js"></script> <script src="js/drag.js"></script>
<script src="js/initialize.js"></script> <script src="js/initialize.js"></script>

View File

@ -18,6 +18,10 @@ $.ajax({
success: function (response) { success: function (response) {
var lastIndex = response.length - 1; var lastIndex = response.length - 1;
if(response.length <= index){
return;
}
listContent(response, lastIndex); listContent(response, lastIndex);
if (response[lastIndex]['hasCode']) if (response[lastIndex]['hasCode'])

View File

@ -127,6 +127,7 @@ function listContent(json, num) {
sidebar.append($('<div>').append($('<span>').append(' · ' + json[index]['title']))); sidebar.append($('<div>').append($('<span>').append(' · ' + json[index]['title'])));
} }
} }
$('.loading').remove();
} }
function getQueryString(param) { function getQueryString(param) {

View File

@ -6,6 +6,8 @@
dataType: "json", dataType: "json",
success: function (response) { success: function (response) {
if (response.length <= index)
return;
listContent(response, index); listContent(response, index);
if (response[index]['hasCode']) if (response[index]['hasCode'])

View File

@ -43,7 +43,14 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="mask"></div> --> <div class="loading">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="js/drag.js"></script> <script src="js/drag.js"></script>
<script src="js/initialize.js"></script> <script src="js/initialize.js"></script>