aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-06-02 15:49:30 -0400
committerBobby <[email protected]>2023-06-02 15:49:30 -0400
commit34bf98bb90f89cba6932050df70e510f150008ac (patch)
treec31e1f06bccebcaa26bc7b8cb2f3b0651bef9c9d
parent1ac450ad7db8d75b77037158ef4e80bc810a8573 (diff)
downloadthatcomputerscientist-34bf98bb90f89cba6932050df70e510f150008ac.tar.xz
thatcomputerscientist-34bf98bb90f89cba6932050df70e510f150008ac.zip
Equation wraps on smaller screens
-rw-r--r--templates/blog/partials/base.html24
1 files changed, 17 insertions, 7 deletions
diff --git a/templates/blog/partials/base.html b/templates/blog/partials/base.html
index e1d0677c..b08d116b 100644
--- a/templates/blog/partials/base.html
+++ b/templates/blog/partials/base.html
@@ -57,13 +57,9 @@
href="{% static 'images/favicons/site.webmanifest' %}"
/>
<style>
- .transition-fade {
- transition: 0.4s;
- opacity: 1;
- }
-
- html.is-animating .transition-fade {
- opacity: 0;
+ .equation-container {
+ overflow-x: scroll;
+ white-space: nowrap; /* Prevent line breaks */
}
</style>
</head>
@@ -185,5 +181,19 @@
};
});
});
+
+ document.addEventListener("DOMContentLoaded", function() {
+ var equationElements = document.getElementsByTagName("*");
+
+ for (var i = 0; i < equationElements.length; i++) {
+ var element = equationElements[i];
+
+ if (element.innerHTML.startsWith("$$") && element.innerHTML.endsWith("$$")) {
+ element.style.overflowX = "scroll";
+ element.style.whiteSpace = "nowrap";
+ element.classList.add("equation-container");
+ }
+ }
+ });
</script>
</html>