Commit ae5ad01db9c7cd2959c387973ef39c06d4af7f6a
1 parent
c2c647ab
Animations !
Also typo fix
Showing
1 changed file
with
25 additions
and
6 deletions
Show diff stats
js/crep.js
@@ -37,16 +37,35 @@ function dynamiseLinks(el) { | @@ -37,16 +37,35 @@ function dynamiseLinks(el) { | ||
37 | 37 | ||
38 | function loadDoc(location, callback) { | 38 | function loadDoc(location, callback) { |
39 | if (!callback) { | 39 | if (!callback) { |
40 | - callaback = function () { | 40 | + callback = function () { |
41 | return undefined | 41 | return undefined |
42 | } | 42 | } |
43 | } | 43 | } |
44 | + var eventsLeft = 2 | ||
45 | + var html = '' | ||
46 | + | ||
47 | + function events() { | ||
48 | + eventsLeft += -1 | ||
49 | + if (eventsLeft <= 0) { | ||
50 | + mainContainer.html(html) | ||
51 | + dynamiseLinks(mainContainer) | ||
52 | + pageSpecific(location) | ||
53 | + mainContainer.animate({ | ||
54 | + height: "toggle", | ||
55 | + opacity: 1 | ||
56 | + }) | ||
57 | + console.debug(callback) | ||
58 | + callback() | ||
59 | + } | ||
60 | + } | ||
61 | + var mainContainer = $("#mainContainer") | ||
62 | + mainContainer.animate({ | ||
63 | + height: "toggle", | ||
64 | + opacity: 0 | ||
65 | + }, 'fast', events) | ||
44 | $.get(location + '?c', function (data) { | 66 | $.get(location + '?c', function (data) { |
45 | - mainContainer = $("#mainContainer") | ||
46 | - mainContainer.html(data) | ||
47 | - dynamiseLinks(mainContainer) | ||
48 | - pageSpecific(location) | ||
49 | - callback() | 67 | + html = data |
68 | + events() | ||
50 | }) | 69 | }) |
51 | 70 | ||
52 | } | 71 | } |