Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +17 -3
templates/index.html
CHANGED
@@ -44,10 +44,24 @@
|
|
44 |
|
45 |
function navigate(url) {
|
46 |
const flashcard = document.getElementById('flashcard');
|
47 |
-
flashcard
|
48 |
-
setTimeout(function() {
|
49 |
window.location.href = url;
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
</script>
|
53 |
</body>
|
|
|
44 |
|
45 |
function navigate(url) {
|
46 |
const flashcard = document.getElementById('flashcard');
|
47 |
+
animateFadeOut(flashcard, function() {
|
|
|
48 |
window.location.href = url;
|
49 |
+
});
|
50 |
+
}
|
51 |
+
|
52 |
+
function animateFadeOut(element, callback) {
|
53 |
+
let opacity = 1;
|
54 |
+
function fade() {
|
55 |
+
opacity -= 0.1;
|
56 |
+
if (opacity <= 0) {
|
57 |
+
element.style.opacity = 0;
|
58 |
+
callback();
|
59 |
+
} else {
|
60 |
+
element.style.opacity = opacity;
|
61 |
+
requestAnimationFrame(fade);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
fade();
|
65 |
}
|
66 |
</script>
|
67 |
</body>
|