updated hiding buttons js

This commit is contained in:
Thomas G 2022-07-13 21:59:46 +10:00
parent 245bbf76aa
commit 8e5d758115
1 changed files with 31 additions and 32 deletions

View File

@ -1,11 +1,11 @@
window.addEventListener('resize', function() { window.addEventListener('resize', function() {
var logo_full = document.getElementById("logo_full") var logo_full = document.getElementById("logo_full")
var logo_small = document.getElementById("logo_small") var logo_small = document.getElementById("logo_small")
var smallbtn0 = document.getElementById("smallbtn0") var BuildBtn = document.getElementById("smallbtn0")
var smallbtn2 = document.getElementById("smallbtn2") var ProfileBtn = document.getElementById("smallbtn2")
var smallbtn3 = document.getElementById("smallbtn3") var SettingsBtn = document.getElementById("smallbtn3")
var smallbtn1 = document.getElementById("smallbtn4") var CatalogBtn = document.getElementById("smallbtn4")
var smallbtn5 = document.getElementById("smallbtn5") var GameBtn = document.getElementById("smallbtn5")
var navbarusername = document.getElementById("navbarusername") var navbarusername = document.getElementById("navbarusername")
var viewport_width = window.innerWidth; var viewport_width = window.innerWidth;
if (viewport_width < 900) { if (viewport_width < 900) {
@ -16,39 +16,38 @@ window.addEventListener('resize', function() {
logo_full.className = ""; logo_full.className = "";
} }
if (viewport_width < 730) { if (viewport_width < 730) {
smallbtn2.className = "invisible"; BuildBtn.className = "invisible";
smallbtn3.className = "invisible"; CatalogBtn.className = "invisible";
} else { } else {
smallbtn2.className = "navbarbutton"; BuildBtn.className = "navbarbutton";
smallbtn3.className = "navbarbutton"; CatalogBtn.className = "navbarbutton";
} }
if (viewport_width < 564 ) { if (viewport_width < 564 ) {
smallbtn0.className = "invisible"; GameBtn.className = "invisible";
smallbtn1.className = "invisible"; ProfileBtn.className = "invisible";
} else { } else {
smallbtn0.className = "navbarbutton"; GameBtn.className = "navbarbutton";
smallbtn1.className = "navbarbutton"; ProfileBtn.className = "navbarbutton";
} }
if (viewport_width < 400) { if (viewport_width < 400) {
smallbtn5.className = "invisible"; SettingsBtn.className = "invisible";
} else { } else {
smallbtn5.className = "navbarbutton"; SettingsBtn.className = "navbarbutton";
} }
if (viewport_width < 360) { if (viewport_width < 360) {
navbarusername.className = "invisible"; navbarusername.className = "invisible";
} else { } else {
navbarusername.className = "nonbolded"; navbarusername.className = "nonbolded";
} }
}); });
window.onload = function() { window.onload = function() {
var logo_full = document.getElementById("logo_full") var logo_full = document.getElementById("logo_full")
var logo_small = document.getElementById("logo_small") var logo_small = document.getElementById("logo_small")
var smallbtn0 = document.getElementById("smallbtn0") var BuildBtn = document.getElementById("smallbtn0")
var smallbtn2 = document.getElementById("smallbtn2") var ProfileBtn = document.getElementById("smallbtn2")
var smallbtn3 = document.getElementById("smallbtn3") var SettingsBtn = document.getElementById("smallbtn3")
var smallbtn1 = document.getElementById("smallbtn4") var CatalogBtn = document.getElementById("smallbtn4")
var smallbtn5 = document.getElementById("smallbtn5") var GameBtn = document.getElementById("smallbtn5")
var navbarusername = document.getElementById("navbarusername") var navbarusername = document.getElementById("navbarusername")
var viewport_width = window.innerWidth; var viewport_width = window.innerWidth;
if (viewport_width < 900) { if (viewport_width < 900) {
@ -59,23 +58,23 @@ window.onload = function() {
logo_full.className = ""; logo_full.className = "";
} }
if (viewport_width < 730) { if (viewport_width < 730) {
smallbtn2.className = "invisible"; BuildBtn.className = "invisible";
smallbtn3.className = "invisible"; CatalogBtn.className = "invisible";
} else { } else {
smallbtn2.className = "navbarbutton"; BuildBtn.className = "navbarbutton";
smallbtn3.className = "navbarbutton"; CatalogBtn.className = "navbarbutton";
} }
if (viewport_width < 564) { if (viewport_width < 564 ) {
smallbtn0.className = "invisible"; GameBtn.className = "invisible";
smallbtn1.className = "invisible"; ProfileBtn.className = "invisible";
} else { } else {
smallbtn0.className = "navbarbutton"; GameBtn.className = "navbarbutton";
smallbtn1.className = "navbarbutton"; ProfileBtn.className = "navbarbutton";
} }
if (viewport_width < 400) { if (viewport_width < 400) {
smallbtn5.className = "invisible"; SettingsBtn.className = "invisible";
} else { } else {
smallbtn5.className = "navbarbutton"; SettingsBtn.className = "navbarbutton";
} }
if (viewport_width < 360) { if (viewport_width < 360) {
navbarusername.className = "invisible"; navbarusername.className = "invisible";