Finally got the back and forward buttons to work! (else if)

This commit is contained in:
Squirrel-314 2021-01-15 12:55:14 -05:00
parent 0abd46a7a7
commit 482dca557c
3 changed files with 30 additions and 12 deletions

View file

@ -19,7 +19,7 @@
<br><br>
<p class="about-me">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 <a class="hover-link" href="https://github.com/Squirrel-314">here</a>, 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.</p>
</div>
<div class="next" onclick="next()">
<div class="next" id="next" onclick="next()">
<span class="arrow">&#10230;</span>
</div>
</div>

36
main.js
View file

@ -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";
}
}

View file

@ -199,7 +199,7 @@ Vegetable Dash
/* Opening Animation */
.meet-vegetable {
text-shadow: 0 0 2px #262626;
}
/*
.meet-vegetable {