Commit 704388e1 authored by techird's avatar techird

add image preload

parent 4ee7ec73
...@@ -27,17 +27,29 @@ ...@@ -27,17 +27,29 @@
apiKey: 'wiE55BGOG8BkGnpPs6UNtPbb' apiKey: 'wiE55BGOG8BkGnpPs6UNtPbb'
}); });
$('hr').addClass('loading');
var $a = $('p.login a').hide(); var $a = $('p.login a').hide();
function loadingAnimate(on) {
if (on) {
$('hr').addClass('loading');
loadingAnimate.timer = setTimeout(function() {
$('hr').addClass('animated');
}, 660);
} else {
clearTimeout(loadingAnimate.timer);
$('hr').removeClass('loading animated');
}
}
loadingAnimate(true);
fio.user.check().then(function(user) { fio.user.check().then(function(user) {
if (user) { if (user) {
window.location.href = 'edit.html'; window.location.href = 'edit.html';
} }
else { else {
$a.fadeIn(800); $a.fadeIn(800);
$('hr').removeClass('loading'); loadingAnimate(false);
} }
}); });
...@@ -49,7 +61,20 @@ ...@@ -49,7 +61,20 @@
redirectUrl: urlparts + '/edit.html', redirectUrl: urlparts + '/edit.html',
remember: 7 * 24 * 60 * 60 remember: 7 * 24 * 60 * 60
}); });
$('hr').addClass('loading'); loadingAnimate(true);
});
function preload(url) {
return new Promise(function(resolve, reject) {
var img = new Image();
img.onload = resolve;
img.onerror = reject;
img.src = url;
});
}
preload('ui/theme/default/images/indexbackground.jpg').then(function() {
$('div.background').addClass('loaded');
}); });
}); });
...@@ -63,11 +88,35 @@ ...@@ -63,11 +88,35 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
-webkit-user-select: none; height: 100%;
font-size: 0;
line-height: 0;
z-index: -2;
} }
h1:before { body {
content: ' '; background: #99806B;
}
::-webkit-selection {
background: #FFEFEF;
color: #4A4F5D;
}
::-moz-selection {
background: #FFEFEF;
color: #4A4F5D;
}
::-ms-selection {
background: #FFEFEF;
color: #4A4F5D;
}
::selection {
background: #FFEFEF;
color: #4A4F5D;
}
div.background {
opacity: 0;
display: block; display: block;
background: url(ui/theme/default/images/indexbackground.jpg) no-repeat; background: url(ui/theme/default/images/indexbackground.jpg) no-repeat;
background-size: cover; background-size: cover;
...@@ -83,9 +132,15 @@ ...@@ -83,9 +132,15 @@
-o-filter: blur(5px); -o-filter: blur(5px);
filter: url(ui/theme/default/images/blur.svg#blur); filter: url(ui/theme/default/images/blur.svg#blur);
filter: blur(5px); filter: blur(5px);
-webkit-transition: opacity 1.5s ease;
transition: opacity 1.5s ease;
} }
h1:after { div.background.loaded {
opacity: 1;
}
h1:before {
content: ' '; content: ' ';
display: block; display: block;
position: absolute; position: absolute;
...@@ -93,7 +148,7 @@ ...@@ -93,7 +148,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
background: rgba(0, 0, 0, .75); background: rgba(0, 0, 0, .5);
z-index: -1; z-index: -1;
} }
...@@ -119,34 +174,40 @@ ...@@ -119,34 +174,40 @@
border-bottom: 1px solid #F98183; border-bottom: 1px solid #F98183;
width: 110px; width: 110px;
margin: 40px auto; margin: 40px auto;
transition: transform 0.5s ease; -webkit-transition: -webkit-transform 0.66s ease;
-webkit-transition: -webkit-transform 0.5s ease; transition: transform 0.66s ease;
-webkit-backface-visibility: hidden;
} }
hr.loading { hr.loading {
-webkit-transform: translate3d(100px, 0, 0);
transform: translate3d(100px, 0, 0);
}
hr.animated {
-webkit-animation: slide 1.33s ease-in-out infinite alternate; -webkit-animation: slide 1.33s ease-in-out infinite alternate;
animation: slide 1.33s ease-in-out infinite alternate; animation: slide 1.33s ease-in-out infinite alternate;
} }
@-webkit-keyframes slide { @-webkit-keyframes slide {
0% { 0% {
transform: translate3d(-100px, 0, 0); -webkit-transform: translate3d(100px, 0, 0);
-webkit-transform: translate3d(-100px, 0, 0); transform: translate3d(100px, 0, 0);
} }
100% { 100% {
transform: translate3d(100px, 0, 0);
-webkit-transform: translate3d(-100px, 0, 0); -webkit-transform: translate3d(-100px, 0, 0);
transform: translate3d(-100px, 0, 0);
} }
} }
@keyframes slide { @keyframes slide {
0% { 0% {
transform: translate3d(-100px, 0, 0); -webkit-transform: translate3d(100px, 0, 0);
-webkit-transform: translate3d(-100px, 0, 0); transform: translate3d(100px, 0, 0);
} }
100% { 100% {
transform: translate3d(100px, 0, 0);
-webkit-transform: translate3d(-100px, 0, 0); -webkit-transform: translate3d(-100px, 0, 0);
transform: translate3d(-100px, 0, 0);
} }
} }
...@@ -171,6 +232,10 @@ ...@@ -171,6 +232,10 @@
position: relative; position: relative;
overflow: hidden; overflow: hidden;
margin-top: 50px; margin-top: 50px;
-webkit-user-select: none;
-moz-user-select: none;
-mz-user-select: none;
user-select: none;
} }
p.login a:active { p.login a:active {
...@@ -203,6 +268,7 @@ ...@@ -203,6 +268,7 @@
</style> </style>
</head> </head>
<body> <body>
<div class="background"></div>
<h1>百度脑图 <br/> 便捷的思维编辑工具</h1> <h1>百度脑图 <br/> 便捷的思维编辑工具</h1>
<hr /> <hr />
<p class="description"> <p class="description">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment