-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51a5d4f
commit 47824ce
Showing
4 changed files
with
141 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,103 @@ | ||
import $ from 'jquery' | ||
import $ from "jquery"; | ||
|
||
class headerNavbar extends HTMLElement { | ||
constructor () { | ||
super() | ||
this.render() | ||
this.toggleMenu() | ||
constructor() { | ||
super(); | ||
this.render(); | ||
this.toggleMenu(); | ||
} | ||
|
||
toggleMenu () { | ||
$('#nav-btn').click(() => { | ||
$('.menu').toggleClass('hidden-menu') | ||
}) | ||
toggleMenu() { | ||
$("#nav-btn").click(() => { | ||
$(".menu").toggleClass("hidden-menu"); | ||
}); | ||
} | ||
|
||
render () { | ||
render() { | ||
this.innerHTML = ` | ||
<style> | ||
header-navbar { | ||
height: 50px; max-height: 50px; | ||
position: relative; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-bottom: 1px solid black; | ||
} | ||
header-navbar h1.tittle { | ||
font-size: 1.35rem; | ||
} | ||
.navbar .menu { | ||
display: flex; | ||
gap: 25px; | ||
} | ||
.navbar a, a::after {position: relative;} | ||
.navbar a::after{ | ||
content: ""; position: absolute; | ||
bottom: -3px; left: 0; | ||
width: 0; height: 0.2rem; | ||
background: var(--main-color); | ||
transition: width 0.3s ease; | ||
} | ||
.navbar a:hover::after{ | ||
width: 100%; | ||
} | ||
.navbar a { | ||
cursor: pointer; | ||
} | ||
.navbar-list {display: none;} | ||
#nav-btn {display: none;} | ||
@media (max-width:600px) { | ||
.hidden-menu {display: none !important;} | ||
#nav-btn {display: flex;} | ||
.navbar .menu { | ||
width: 100%; | ||
padding: 10px 0; | ||
margin-top: 25px; | ||
position: absolute; | ||
left: 0; | ||
<style> | ||
header-navbar { | ||
height: 50px; max-height: 50px; | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
background-color: #efefef; | ||
z-index: 5; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-bottom: 0.5px solid var(--text); | ||
} | ||
.navbar .menu a { | ||
text-align: center; | ||
header-navbar h1.tittle { | ||
font-size: 1.35rem; | ||
z-index: 5 | ||
} | ||
.navbar a::after{display: none;} | ||
.navbar-list { | ||
.navbar .menu { | ||
display: flex; | ||
gap: 25px; | ||
z-index: 5 | ||
} | ||
.navbar a, a::after {position: relative;} | ||
.navbar a::after{ | ||
content: ""; position: absolute; | ||
bottom: -3px; left: 0; | ||
width: 0; height: 0.2rem; | ||
background: var(--main-color); | ||
transition: width 0.3s ease; | ||
} | ||
.navbar a:hover::after{ | ||
width: 100%; | ||
} | ||
.navbar a { | ||
cursor: pointer; | ||
z-index: 5 | ||
} | ||
.navbar-list {display: none;} | ||
#nav-btn { | ||
display: none; | ||
z-index: 10; | ||
padding-right: 15px; | ||
transform: scale(1.5); | ||
} | ||
@media (max-width:600px) { | ||
.hidden-menu {display: none !important;} | ||
#nav-btn {display: flex;} | ||
.navbar .menu { | ||
width: 100%; | ||
padding: 10px 0; | ||
margin-top: 35px; | ||
position: absolute; | ||
left: 0; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
background-color: #efefef; | ||
z-index: 5; | ||
background: var(--col-2) !important; | ||
} | ||
.navbar .menu a { | ||
text-align: center; | ||
} | ||
.navbar a::after{display: none;} | ||
.navbar-list { | ||
display: flex; | ||
} | ||
} | ||
} | ||
</style> | ||
</style> | ||
<h1 class="tittle">AnimeLab</h1> | ||
<nav class="navbar"> | ||
<div class="menu hidden-menu"> | ||
<a class="nav-link" data-section="home">home</a> | ||
<a class="nav-link" data-section="anime">anime</a> | ||
<a class="nav-link" data-section="manga">manga</a> | ||
<a class="nav-link" data-section="characters">characters</a> | ||
</div> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"> | ||
<i id="nav-btn" class="fa fa-list navbar-list"></i> | ||
<nav class="navbar"> | ||
<div class="menu hidden-menu"> | ||
<a class="nav-link" data-section="home">home</a> | ||
<a class="nav-link" data-section="anime">anime</a> | ||
<a class="nav-link" data-section="manga">manga</a> | ||
<a class="nav-link" data-section="characters">characters</a> | ||
</div> | ||
<i id="nav-btn" class="fa fa-list navbar-list">#</i> | ||
</nav> | ||
` | ||
`; | ||
// <script src="https://kit.fontawesome.com/c90c144b50.js" crossorigin="anonymous"></script> | ||
// <i id="nav-btn" class="fa fa-list navbar-list"></i> | ||
} | ||
} | ||
|
||
customElements.define('header-navbar', headerNavbar) | ||
customElements.define("header-navbar", headerNavbar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters