From 1db0fee300bffeb1a75246978f958bff869e1577 Mon Sep 17 00:00:00 2001 From: Zach Magloughlin Date: Thu, 28 Nov 2024 14:09:44 -0700 Subject: [PATCH] Mobile JS working! --- webpage/partials/_projects.scss | 2 +- webpage/projects.js | 97 +++++++++++++++++++-------------- webpage/styles/main.css | 2 +- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/webpage/partials/_projects.scss b/webpage/partials/_projects.scss index 62d5ba5..83f89aa 100644 --- a/webpage/partials/_projects.scss +++ b/webpage/partials/_projects.scss @@ -21,7 +21,7 @@ padding: 20%; text-align: center; font-style: italic; - font-size: 1.25rem; + font-size: 1.5rem; color: v.$dark-gray; } h1.project_title { diff --git a/webpage/projects.js b/webpage/projects.js index c84ac8e..035c6fc 100644 --- a/webpage/projects.js +++ b/webpage/projects.js @@ -9,7 +9,10 @@ var numProjectCategories; var projectMenuDropdown; var mobileView; +var mobileMax = 480; +//Watch for window resizing +window.addEventListener("resize", checkWindowSize); window.onload = function() { //Initialize global variables @@ -17,58 +20,66 @@ window.onload = function() { projectMenuLinks = document.getElementsByClassName("project_category"); projectContentList = document.getElementsByClassName("project_container"); numProjectCategories = projectMenuLinks.length; - - //Watch for window resizing - window.addEventListener('resize', checkWindowSize); projectMenuDropdown = document.getElementById("project_dropdown"); resetProjectMenu(); + checkWindowSize(); +} - if(mobileView) { - projectMenuDropdown.style.display = "block"; - console.log(projectMenuDropdown.style.display); - - //If Projects button is clicked, show list of projects - //If list of projects is clicked, show that category - projectMenuDropdown.addEventListener("click", function() { - //If the dropdown is showing, and the button is clicked, hide the dropdown menu - if(projectMenuLinks[0].classList.contains("visible")) { - hideDropdownList(); - resetProjectContent(); - } - else { - showDropdownList(); - - //Listen for a click on one of the menu items - for (let i=0; i