view transition for javascript
Some checks are pending
/ Generate Site (push) Waiting to run
/ Publish Site (push) Blocked by required conditions

This commit is contained in:
Pagwin 2025-10-28 11:45:21 -04:00
parent 9dcb01b2ae
commit 80b2e2e5b2

View file

@ -78,8 +78,7 @@
}
</style>
<script type="module">
function toggleTheme(e) {
e.preventDefault();
function toggleTheme_() {
fetch('./light-dark-toggle?ref=https%3A%2F%2Fpagwin.xyz%2Fstatic%2Fdemos%2Flight-dark-demo-4%2F')
if (!document.body.classList.contains("toggled")) {
document.body.classList.add("toggled")
@ -88,6 +87,15 @@
document.body.classList.remove("toggled")
}
}
function toggleTheme(e) {
e.preventDefault();
if (document.startViewTransition) {
document.startViewTransition(toggleTheme_);
}
else {
toggleTheme_();
}
}
window.addEventListener("load", () => {
document
.getElementById("full-demo")