Skip to content

Commit

Permalink
script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
semm00 committed Aug 5, 2024
1 parent 89138b4 commit 9c0f213
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
12 changes: 10 additions & 2 deletions css/estilo.css
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,16 @@ footer .copyright .pro-links i:hover{
}

#menu-close{
display: none;
display: initial;
font-size: 1.6rem;
color: #fff;
padding: 30px 0 20px 20px;
}

.navlp .navigation ul {
position: absolute;
top: 0;
right: 0;
right: -220px;
width: 220px;
height: 100vh;
background: #2465939a;
Expand All @@ -663,6 +666,11 @@ footer .copyright .pro-links i:hover{
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
transition: 0.3s ease-in;
}

.navlp .navigation ul.active {
right: 0;
}

.navlp .navigation ul li {
Expand Down
34 changes: 34 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,37 @@ ScrollReveal().reveal('.btn3', {
delay: 2000,
});

class MobileNavbar {
constructor(mobileMenu, navList, closeMenu) {
this.mobileMenu = document.querySelector(mobileMenu);
this.navList = document.querySelector(navList);
this.closeMenu = document.querySelector(closeMenu);
this.activeClass = 'active';
}

handleClick() {
this.navList.classList.toggle(this.activeClass);
this.mobileMenu.classList.toggle(this.activeClass);
this.closeMenu.classList.toggle(this.activeClass);
}

addClickEvent() {
this.mobileMenu.addEventListener("click", this.handleClick.bind(this));
this.closeMenu.addEventListener("click", this.handleClick.bind(this));
}

init(){
if (this.mobileMenu && this.closeMenu) {
this.addClickEvent();
}

return this;
}
}

const mobileNavbar = new MobileNavbar(
'#menu-btn',
'.navlp .navigation ul',
'#menu-close'
);
mobileNavbar.init();
1 change: 1 addition & 0 deletions landingpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<script src="https://kit.fontawesome.com/ca32771bae.js" crossorigin="anonymous"></script>


<link rel="stylesheet" href="css/estilo.css" />
</head>

Expand Down

0 comments on commit 9c0f213

Please sign in to comment.