Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added jQuery menu
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjacobsio committed Jan 30, 2019
1 parent a36bd48 commit 36bf1db
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 100 deletions.
30 changes: 11 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
crossorigin="anonymous">
<link rel="stylesheet" href="main.css">
<!-- JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="mobile-menu.js"></script>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
Expand All @@ -29,32 +30,23 @@
</a>
<ul>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#tech">Technology</a></li>
<li><a href="#technology">Technology</a></li>
<li><a href="#resume">Resume</a></li>
<li><a href="#about">About</li></a>
</ul>

<div class="mobile-menu-button">
<a href="#showedClickable"><i class="fas fa-bars"></i></a>
<i class="fas fa-bars"></i>
</div>
<!-- <div class="topnav" id="myTopnav">
<a href="#portfolio">Portfolio</a>
<a href="#tech">News</a>
<a href="#resume">Contact</a>
<a href="#about">About</a>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i class="fa fa-bars"></i>
</a>
</div> -->
</div>
<!-- <div id="showedClickable">
<ul>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#tech">Technology</a></li>
<li><a href="#resume">Resume</a></li>
<li><a href="#about">About</li></a>
</ul>
</div> -->
<div id="showedClickable">
<ul>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#tech">Technology</a></li>
<li><a href="#resume">Resume</a></li>
<li><a href="#about">About</li></a>
</ul>
</div>
</nav>
</header>

Expand Down
81 changes: 9 additions & 72 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ a{
}
.stack img{
flex: 1;
margin-right:50px;
margin-right:30px;
margin-bottom:50px;
opacity: 0.7;
width:300px;
Expand All @@ -153,7 +153,6 @@ a{
}
#resume{
background-color: #fff !important;
padding:50px;
}
#technology{
background-color:whitesmoke;
Expand Down Expand Up @@ -221,7 +220,7 @@ a{
}
#showedClickable ul{
margin:auto;
list-style-type: none;xxx
list-style-type: none;
}
@media screen and (max-width: 800px){
footer {
Expand All @@ -243,7 +242,8 @@ footer {
display: none;
}
.stack-img{
margin-left:20%;
margin-left:10%;
width:100%;
margin-bottom:50px;
}
.navbar ul{
Expand All @@ -267,13 +267,12 @@ footer {
color:#fff;
}
#showedClickable{
display:block;
display:none;
font-size:1.5rem;
width:100%;
text-align:center;
padding-top: 9%;
padding-top: 68px;
position:relative;
display:flex;
}
#showedClickable ul {
flex:1;
Expand All @@ -293,69 +292,7 @@ footer {
text-decoration:none;
color:rgb(124, 124, 124);
}
#showedClickable ul li:hover{
background-color:gray;
color:white;
}
main{
padding-top: 0px;
}
/* Add a black background color to the top navigation */
.topnav {
/* background-color: #333; */
overflow: hidden;
}

/* Style the links inside the navigation bar */
.topnav a {
background-color: #333;
float: left;
display: none;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}

/* Change the color of links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}

/* Add an active class to highlight the current page */
.active {
background-color: #4CAF50;
color: white;
}

/* Hide the link that should open and close the topnav on small screens */
.topnav .icon {
display: none;
}

/* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */
@media screen and (max-width: 600px) {
.topnav a:not(:first-child) {display: none;}
.topnav a.icon {
float: right;
display: block;
}
}

/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */
@media screen and (max-width: 600px) {
.topnav.responsive {position: relative;}
.topnav.responsive a.icon {
position: absolute;
right: 0;
top: 0;
}
.topnav.responsive a {
float: none;
display: block;
text-align: left;
}
}

padding-top: 68px;
}
}
27 changes: 18 additions & 9 deletions mobile-menu.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
/* Toggle between adding and removing the "responsive" class to topnav when the user clicks on the icon */
// function myFunction() {
// var x = document.getElementById("myTopnav");
// if (x.className === "topnav") {
// x.className += " responsive";
// } else {
// x.className = "topnav";
// }
// }
$(function(){
"use strict"

let isMenuShown = false;

$('.mobile-menu-button').click(function(){
if(!isMenuShown){
$('#showedClickable').show("slow");
$('main').css('padding-top', '0px')
isMenuShown = true;
}else{
$('#showedClickable').hide("slow");
$('main').css('padding-top', '68px')
isMenuShown = false;
}

})
})

0 comments on commit 36bf1db

Please sign in to comment.