Skip to content

Commit

Permalink
Added animations to jp-Cells in index.html.j2
Browse files Browse the repository at this point in the history
  • Loading branch information
johnW-ret committed Apr 22, 2024
1 parent 13d2a96 commit b8f700f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions responsive/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
<meta name="twitter:description" content="A quick guide to get you up and running with F#, starting from the bare basics. View as a simple webpage or a notebook with Codespaces.">
<style>
/* amazing css 🫡 */
@keyframes fadeTopDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.fade-in-top {
animation: fadeTopDown 0.3s ease forwards;
}
.cm-editor {
overflow: auto;
white-space: nowrap;
Expand All @@ -25,6 +40,27 @@
--jp-content-font-size5: 1.6em;
}
.jp-Cell {
opacity: 0;
transform: translateY(-20px);
}
@media (prefers-reduced-motion: reduce) or (scripting: none) {
.jp-Cell {
opacity: revert-layer;
transform: revert-layer;
}
/* https://www.a11yproject.com/posts/understanding-vestibular-disorders#what-should-you-consider%3F */
*,
::before,
::after {
animation-duration: 0.001s !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001s !important;
}
}
.jp-MarkdownCell {
--jp-content-font-size1: 2.5rem;
margin: 0 auto;
Expand Down Expand Up @@ -75,4 +111,20 @@
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
const observer = new IntersectionObserver(entries => {
for (var entry of entries) {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in-top');
}
}
}, { threshold: 0.4, rootMargin: "0px 0px -40% 0px" });
for (var el of document.querySelectorAll('.jp-Cell').values()) {
// cannot just pass the func idk why
observer.observe(el);
}
});
</script>
{%- endblock html_head -%}

0 comments on commit b8f700f

Please sign in to comment.