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> <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> <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>
<div class="next" onclick="next()"> <div class="next" id="next" onclick="next()">
<span class="arrow">&#10230;</span> <span class="arrow">&#10230;</span>
</div> </div>
</div> </div>

36
main.js
View file

@ -1,24 +1,42 @@
let pageLocation = "meet";
let backButton = document.getElementById("back"); let backButton = document.getElementById("back");
let nextButton = document.getElementById("next");
if (window.location.href != "https://meetsquirrel.github.io" || "https://meetsquirrel.github.io#meet") {
backButton.style.opacity = "1";
}
function 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"; 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"; document.location = "#coming-soon";
pageLocation = "coming-soon";
} }
buttonVisiblility();
} }
function last() { function last() {
if (window.location.href == "https://meetsquirrel.github.io/#vegetable-dash") { if (pageLocation === "vegetable-dash") {
document.location = "#meet"; 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"; backButton.style.opacity = "0";
} }
if (window.location.href == "https://meetsquirrel.github.io/index.html#coming-soon") { if (pageLocation != "coming-soon") {
document.location = "#vegetable-dash"; nextButton.style.opacity = "1";
}
else {
nextButton.style.opacity = "0";
} }
} }

View file

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