Added header
This commit is contained in:
commit
6b8dda9014
9 changed files with 306 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.DS_Store
|
||||||
14
about.html
Normal file
14
about.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>About Me</title>
|
||||||
|
<script src="header.js" defer></script>
|
||||||
|
<site-header></site-header>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
About
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
31
header.js
Normal file
31
header.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
class SiteHeader extends HTMLElement {
|
||||||
|
connectedCallback() {
|
||||||
|
fetch("site-header.html")
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(html => {
|
||||||
|
this.innerHTML = html;
|
||||||
|
detectPage();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
customElements.define('site-header', SiteHeader);
|
||||||
|
|
||||||
|
function detectPage() {
|
||||||
|
var pageId = document.title.toLowerCase().replace(/ /g, "-");
|
||||||
|
var element = document.getElementById(pageId);
|
||||||
|
if (element) {
|
||||||
|
element.className = "active";
|
||||||
|
} else {
|
||||||
|
console.warn("Could not find a navigation link matching the ID: " + pageId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleMobileMenu() {
|
||||||
|
var nav = document.getElementById("myTopnav");
|
||||||
|
|
||||||
|
if (nav.className === "topnav") {
|
||||||
|
nav.className += " responsive";
|
||||||
|
} else {
|
||||||
|
nav.className = "topnav";
|
||||||
|
}
|
||||||
|
}
|
||||||
14
index.html
Normal file
14
index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Home</title>
|
||||||
|
<script src="header.js" defer></script>
|
||||||
|
<site-header></site-header>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Home
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
logo.png
Normal file
BIN
logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
19
mcservers.html
Normal file
19
mcservers.html
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Minecraft Servers</title>
|
||||||
|
<script src="header.js" defer></script>
|
||||||
|
<site-header></site-header>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: url(media/mc\ header.png) no-repeat top center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Mineraft
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
media/mc header.png
Normal file
BIN
media/mc header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
14
projects.html
Normal file
14
projects.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Projects</title>
|
||||||
|
<script src="header.js" defer></script>
|
||||||
|
<site-header></site-header>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Projects
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
213
site-header.html
Normal file
213
site-header.html
Normal file
|
|
@ -0,0 +1,213 @@
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--primary-glow: #ff2a2a;
|
||||||
|
--active-bg: #aa0404;
|
||||||
|
--header-height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
margin: 20px auto;
|
||||||
|
width: 92%;
|
||||||
|
max-width: 1920px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-capsule {
|
||||||
|
background-color: #00000000;
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
height: var(--header-height);
|
||||||
|
width: max-content;
|
||||||
|
min-width: 60px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-capsule a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-capsule:hover {
|
||||||
|
background-color: #00000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-capsule img {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
width: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav {
|
||||||
|
background-color: #000000;
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
position: relative;
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
|
height: var(--header-height);
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
padding: 0 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 17px;
|
||||||
|
position: relative;
|
||||||
|
transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
width: 0;
|
||||||
|
height: 3px;
|
||||||
|
background-color: var(--primary-glow);
|
||||||
|
transition: width 0.3s ease, left 0.3s ease;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a:hover::after {
|
||||||
|
width: calc(100% - 40px);
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a:hover {
|
||||||
|
background-color: #ff2a2a6f;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a.active {
|
||||||
|
background-color: var(--active-bg);
|
||||||
|
color: white;
|
||||||
|
box-shadow: inset 0 -4px 15px rgba(255, 42, 42, 0.4), 0 0 15px rgba(255, 42, 42, 0.3);
|
||||||
|
text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav .icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.header-container {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: var(--header-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
flex-grow: 0;
|
||||||
|
width: 60px;
|
||||||
|
height: var(--header-height);
|
||||||
|
transition: width 0.3s ease-in-out, height 0.3s ease-in-out, background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav.responsive {
|
||||||
|
width: 100%;
|
||||||
|
height: 315px;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a:not(.icon) {
|
||||||
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav.responsive a:not(.icon) {
|
||||||
|
display: flex;
|
||||||
|
height: 60px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-left: 20px;
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.3s ease 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav.responsive a:not(.icon):nth-child(1) {
|
||||||
|
margin-top: calc(var(--header-height) + 15px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav.responsive a:not(.icon)::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav a.icon {
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: var(--header-height);
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: auto;
|
||||||
|
color: #f2f2f2;
|
||||||
|
padding: 0;
|
||||||
|
z-index: 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav.responsive a.icon {
|
||||||
|
left: auto;
|
||||||
|
width: 60px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="header-container" id="headerContainer">
|
||||||
|
|
||||||
|
<div class="logo-capsule">
|
||||||
|
<a href="index.html" id="logo">
|
||||||
|
<img src="logo.png" alt="Half Heart Logo">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="topnav" id="myTopnav">
|
||||||
|
<a href="index.html" id="home" class="inactive">Home</a>
|
||||||
|
<a href="about.html" id="about-me" class="inactive">About Me</a>
|
||||||
|
<a href="projects.html" id="projects" class="inactive">Projects</a>
|
||||||
|
<a href="mcservers.html" id="minecraft-servers" class="inactive">Minecraft Server</a>
|
||||||
|
<a href="javascript:void(0);" class="icon" onclick="toggleMobileMenu()">
|
||||||
|
<i class="fa fa-bars"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue