diff --git a/js/crep.js b/js/crep.js index 7093f6d..2679c65 100755 --- a/js/crep.js +++ b/js/crep.js @@ -37,16 +37,35 @@ function dynamiseLinks(el) { function loadDoc(location, callback) { if (!callback) { - callaback = function () { + callback = function () { return undefined } } + var eventsLeft = 2 + var html = '' + + function events() { + eventsLeft += -1 + if (eventsLeft <= 0) { + mainContainer.html(html) + dynamiseLinks(mainContainer) + pageSpecific(location) + mainContainer.animate({ + height: "toggle", + opacity: 1 + }) + console.debug(callback) + callback() + } + } + var mainContainer = $("#mainContainer") + mainContainer.animate({ + height: "toggle", + opacity: 0 + }, 'fast', events) $.get(location + '?c', function (data) { - mainContainer = $("#mainContainer") - mainContainer.html(data) - dynamiseLinks(mainContainer) - pageSpecific(location) - callback() + html = data + events() }) } -- libgit2 0.21.2