summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-03-27 15:43:28 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-03-27 15:43:28 +0800
commit4a2835154ffc7b7356d229d233132c5430d42f86 (patch)
tree3b60377adc179edc43dfb667ee56c739d4b617b0
parentff253a30044553da0fcd6372fd32500eb55759a1 (diff)
added swup effect/transition when switching pages
-rw-r--r--src/js/swup.js2
-rw-r--r--src/js/transition.js13
2 files changed, 15 insertions, 0 deletions
diff --git a/src/js/swup.js b/src/js/swup.js
new file mode 100644
index 00000000..0866c441
--- /dev/null
+++ b/src/js/swup.js
@@ -0,0 +1,2 @@
+import Swup from 'https://unpkg.com/swup@4?module';
+const swup = new Swup(); \ No newline at end of file
diff --git a/src/js/transition.js b/src/js/transition.js
new file mode 100644
index 00000000..01bd11fc
--- /dev/null
+++ b/src/js/transition.js
@@ -0,0 +1,13 @@
+let a = document.querySelectorAll("a")
+
+a.forEach(element => {
+ element.onclick = event => {
+ element.classList.add("openlink")
+ element.innerHTML = `
+ <iframe src="/" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
+ `
+ element.style.zIndex = 999999
+ element.style.overflow = "auto !important"
+ setTimeout(function(){element.classList.remove("openlink")}, 3000);
+ }
+})