From 482dca557c7f3d9ec9d697ccc8e64dc4c5665cc9 Mon Sep 17 00:00:00 2001 From: Squirrel-314 Date: Fri, 15 Jan 2021 12:55:14 -0500 Subject: [PATCH] Finally got the back and forward buttons to work! (else if) --- index.html | 2 +- main.js | 36 +++++++++++++++++++++++++++--------- styles.css | 4 ++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index d87369b..58cf2e1 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@

I am not a web developer, but I do spend a lot of time programming. I like CSS transitions and I think everyone should use them. I know HTML, CSS, JavaScript, and Electron, and am currently in the process of learing React and Node. Linux is my faviorite OS (I use Kubuntu, looking into Deepin). You can see my GitHub account here, and check out all the organizations I am in alone. Like my repositories? Please put up issues for any mistakes, and if you have a suggestion, also make an issue. No, I didn't mean it that way, it's just eaisier for me to see.

- diff --git a/main.js b/main.js index 9b9f558..2c02e4b 100644 --- a/main.js +++ b/main.js @@ -1,24 +1,42 @@ +let pageLocation = "meet"; let backButton = document.getElementById("back"); - -if (window.location.href != "https://meetsquirrel.github.io" || "https://meetsquirrel.github.io#meet") { - backButton.style.opacity = "1"; -} +let nextButton = document.getElementById("next"); function next() { - if (window.location.href == "https://meetsquirrel.github.io/index.html" || "file:///D:/Documents/GitHub/meetsquirrel.github.io/index.html#meet") { + if (pageLocation === "meet") { document.location = "#vegetable-dash"; + pageLocation = "vegetable-dash"; } - if (window.location.href == "https://meetsquirrel.github.io/#vegetable-dash") { + else if (pageLocation === "vegetable-dash") { document.location = "#coming-soon"; + pageLocation = "coming-soon"; } + buttonVisiblility(); } function last() { - if (window.location.href == "https://meetsquirrel.github.io/#vegetable-dash") { + if (pageLocation === "vegetable-dash") { document.location = "#meet"; + pageLocation = "meet"; + } + else if (pageLocation === "coming-soon") { + document.location = "#vegetable-dash"; + pageLocation = "vegetable-dash"; + } + buttonVisiblility(); +} + +function buttonVisiblility() { + if (pageLocation != "meet") { + backButton.style.opacity = "1"; + } + else { backButton.style.opacity = "0"; } - if (window.location.href == "https://meetsquirrel.github.io/index.html#coming-soon") { - document.location = "#vegetable-dash"; + if (pageLocation != "coming-soon") { + nextButton.style.opacity = "1"; + } + else { + nextButton.style.opacity = "0"; } } diff --git a/styles.css b/styles.css index 94bbd9d..3b65bed 100644 --- a/styles.css +++ b/styles.css @@ -199,9 +199,9 @@ Vegetable Dash /* Opening Animation */ .meet-vegetable { - text-shadow: 0 0 2px #262626; + } -/* +/* .meet-vegetable { border: 2px solid tomato; background: none;