diff --git a/js/ditto.js b/js/ditto.js index 73fef7e..5c36f4c 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -170,6 +170,11 @@ function show_loading() { } function router() { + + $('html, body').animate({ + scrollTop: $('#content').offset().top + }, 200); + var path = location.hash.replace("#", "./"); // default page if hash is empty @@ -196,6 +201,7 @@ function router() { normalize_paths(); create_page_anchors(); + // 完成代码高亮 $('#content code').map(function() { Prism.highlightElement(this); }); @@ -216,12 +222,6 @@ function router() { })(); })(); - if(path.indexOf('README') === -1){ - $('html, body').animate({ - scrollTop: $('#content').offset().top - }, 200); - } - }).fail(function() { show_error();