mirror of
https://github.com/asimonson1125/asimonson1125.github.io.git
synced 2026-02-25 05:09:49 -06:00
mobile menu overhaul
This commit is contained in:
19
src/App.css
19
src/App.css
@@ -72,7 +72,6 @@ a {
|
|||||||
left: 0;
|
left: 0;
|
||||||
transition: .4s;
|
transition: .4s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-bottom: solid 3px rgb(156, 49, 45, .4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navControl{
|
.navControl{
|
||||||
@@ -93,8 +92,7 @@ a {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
transition: .4s;
|
transition: .4s;
|
||||||
padding-top: .5rem;
|
font-size: 1rem;
|
||||||
padding-bottom: .5rem;
|
|
||||||
background-color: rgb(156, 49, 45, .4);
|
background-color: rgb(156, 49, 45, .4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +104,8 @@ a {
|
|||||||
color: white;
|
color: white;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
display: block;
|
display: block;
|
||||||
|
padding-top: .3rem;
|
||||||
|
padding-bottom: .3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#home {
|
#home {
|
||||||
@@ -315,6 +315,15 @@ a {
|
|||||||
display: unset;
|
display: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header{
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
border-bottom: solid 3px rgb(156, 49, 45, .4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1{
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.navBar {
|
.navBar {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@@ -323,6 +332,10 @@ a {
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navControl{
|
||||||
|
max-height: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.projectList {
|
.projectList {
|
||||||
width: 95%;
|
width: 95%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import Activities from './pages/Activities';
|
|||||||
import AboutMe from './pages/AboutMe';
|
import AboutMe from './pages/AboutMe';
|
||||||
import AOS from 'aos';
|
import AOS from 'aos';
|
||||||
import 'aos/dist/aos.css'; // You can also use <link> for styles
|
import 'aos/dist/aos.css'; // You can also use <link> for styles
|
||||||
import './responsive'
|
import { toggleMenu } from './responsive'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AOS.init();
|
AOS.init();
|
||||||
function App() {
|
function App() {
|
||||||
@@ -19,7 +21,7 @@ function App() {
|
|||||||
<div className="App">
|
<div className="App">
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<a href="/"><h1>Andrew Simonson</h1></a>
|
<a href="/"><h1>Andrew Simonson</h1></a>
|
||||||
<img src={menu} alt="menu" id='menu'/>
|
<img src={menu} alt="menu" id='menu' onClick={toggleMenu}/>
|
||||||
<Nav id='navbar'>
|
<Nav id='navbar'>
|
||||||
<Link to='/'>Home</Link>
|
<Link to='/'>Home</Link>
|
||||||
<a href='Resume.pdf' target='_blank'>Resume</a>
|
<a href='Resume.pdf' target='_blank'>Resume</a>
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag() { dataLayer.push(arguments); }
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'G-E2V93W9CNV');
|
|
||||||
console.log("HHHHHHHHHHHHHH")
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export function toggleMenu(){
|
|
||||||
const e = document.querySelector(".navControl");
|
|
||||||
e.style.display = "";
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,7 @@ export default function AboutMe() {
|
|||||||
{[
|
{[
|
||||||
{
|
{
|
||||||
original: img4,
|
original: img4,
|
||||||
description: "High School VEX Robotics President and Team Leader: I'm trying my best"
|
description: "High School VEX Robotics President and Team Leader"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
original: img5,
|
original: img5,
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
window.onpageshow = function () { onLoaded() };
|
window.onload = function () { onLoaded() };
|
||||||
|
|
||||||
function onLoaded() {
|
function onLoaded() {
|
||||||
|
console.log("loaded trigger");
|
||||||
|
document.body.scrollTop = 0; // For Safari
|
||||||
|
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||||
|
|
||||||
window.onresize = function () { resizer() };
|
window.onresize = function () { resizer() };
|
||||||
document.getElementById("menu").onclick = function () { toggleMenu() };
|
|
||||||
resizer();
|
resizer();
|
||||||
|
if(window.innerWidth < 1200){
|
||||||
|
const e = document.querySelector(".navControl");
|
||||||
|
e.style.maxHeight = '0px';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizer() {
|
function resizer() {
|
||||||
scrollFunction();
|
|
||||||
const e = document.querySelector(".navControl");
|
const e = document.querySelector(".navControl");
|
||||||
if (window.innerWidth > 1200) { // desktop view
|
if (window.innerWidth > 1200) { // desktop view
|
||||||
|
scrollFunction();
|
||||||
window.onscroll = function () { scrollFunction() };
|
window.onscroll = function () { scrollFunction() };
|
||||||
bottomBorderOff();
|
|
||||||
e.style.maxHeight = `${e.scrollHeight + 10}px`;
|
e.style.maxHeight = `${e.scrollHeight + 10}px`;
|
||||||
}
|
}
|
||||||
else { // mobile view
|
else { // mobile view
|
||||||
window.onscroll = '';
|
window.onscroll = '';
|
||||||
document.querySelector('.header').style.backgroundColor = '#1a1a1a';
|
document.querySelector('.header').style.backgroundColor = '#1a1a1a';
|
||||||
document.querySelector('.header > a > h1').style.fontSize = "1.5rem";
|
document.querySelector('.header > a > h1').style.fontSize = "1.5rem";
|
||||||
// document.querySelector('.header > h1').style.color = "#a8a8a8";
|
// document.querySelector('.header > h1').style.color = "#ecebeb";
|
||||||
document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' });
|
document.querySelector(".header").style.borderBottomWidth = '3px';
|
||||||
e.style.maxHeight = '0px';
|
e.style.maxHeight = '0px';
|
||||||
bottomBorderOn();
|
document.querySelectorAll('.navElement *').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,32 +35,23 @@ function scrollFunction() {
|
|||||||
document.querySelector('.header').style.backgroundColor = '#1a1a1a';
|
document.querySelector('.header').style.backgroundColor = '#1a1a1a';
|
||||||
document.querySelector('.header > a > h1').style.fontSize = "1.5rem";
|
document.querySelector('.header > a > h1').style.fontSize = "1.5rem";
|
||||||
// document.querySelector('.header > h1').style.color = "#a8a8a8";
|
// document.querySelector('.header > h1').style.color = "#a8a8a8";
|
||||||
document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' });
|
document.querySelectorAll('.navElement *').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' });
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('.header').style.backgroundColor = 'rgba(0,0,0,0)';
|
document.querySelector('.header').style.backgroundColor = 'rgba(0,0,0,0)';
|
||||||
document.querySelector('.header > a > h1').style.fontSize = "2rem";
|
document.querySelector('.header > a > h1').style.fontSize = "2rem";
|
||||||
// document.querySelector('.header > h1').style.color = "#ecebeb";
|
// document.querySelector('.header > h1').style.color = "#ecebeb";
|
||||||
document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.5rem'; x.style.paddingBottom = '.5rem'; x.style.fontSize = '1.2rem' });
|
document.querySelectorAll('.navElement *').forEach(x => { x.style.paddingTop = '.5rem'; x.style.paddingBottom = '.5rem'; x.style.fontSize = '1.2rem' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMenu() {
|
export function toggleMenu() {
|
||||||
const e = document.querySelector(".navControl");
|
const e = document.querySelector(".navControl");
|
||||||
|
const bar = document.querySelector(".header");
|
||||||
if (e.style.maxHeight === '0px') {
|
if (e.style.maxHeight === '0px') {
|
||||||
bottomBorderOff();
|
|
||||||
e.style.maxHeight = `${e.scrollHeight + 10}px`;
|
e.style.maxHeight = `${e.scrollHeight + 10}px`;
|
||||||
|
bar.style.borderBottomWidth = '0px';
|
||||||
} else {
|
} else {
|
||||||
bottomBorderOn();
|
|
||||||
e.style.maxHeight = '0px';
|
e.style.maxHeight = '0px';
|
||||||
|
bar.style.borderBottomWidth = '3px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bottomBorderOn() {
|
|
||||||
const e = document.querySelector('.header');
|
|
||||||
e.style.borderBottomWidth = "3px";
|
|
||||||
}
|
|
||||||
|
|
||||||
function bottomBorderOff() {
|
|
||||||
const e = document.querySelector('.header');
|
|
||||||
e.style.borderBottomWidth = "0px";
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user