Commit b6f70406 authored by Simon Daron's avatar Simon Daron
Browse files

Add some loading for error handling and ergonomy

parent 6c9f3862
......@@ -243,6 +243,17 @@ nav a.active, nav button.active{
text-align:center;
margin:auto;
}
a.loading, button.loading{
color:#4183C4 !important;
-webkit-animation: loading 1s infinite linear;
-moz-animation: loading 1s infinite linear;
-o-animation: loading 1s infinite linear;
animation: loading 1s infinite linear;
}
@-webkit-keyframes loading {0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}
@-moz-keyframes loading {0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}
@-o-keyframes loading {0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}
@keyframes loading {0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}
@-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
......
......@@ -16,6 +16,7 @@ $(function() {
$('body').attr('id',bodyID);
$('html, body').animate({scrollTop: $main.offset().top-$('#metaNav').height()+2}, 500);
init();
$main.fadeIn();
};
$(window).on("popstate", function(e) {
......@@ -23,16 +24,17 @@ $(function() {
});
loadPage = function(href) {
history.pushState({}, '', href);
$main.load(href + " #Changing>*", null, afterLoad);
$main.fadeOut().load(href + " #Changing>*", null, afterLoad);
};
init = function() {
$("a, area").unbind('click').on('click',function() {
$("a, area").removeClass('loading').unbind('click').on('click',function() {
$(this).addClass('loading');
var href = $(this).attr("href");
if (href.indexOf(document.domain) > -1 || href.indexOf(':') === -1) {
loadPage(href);
return false;
}else{
$(this).attr('target','_blanck');
$(this).attr('target','_blanck');
return true;
}
});
......
Supports Markdown
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