Skip to content

Commit 004bfac

Browse files
committed
create animation in oscured class
1 parent 34e2fe4 commit 004bfac

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

css/navbar.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
padding: 0em;
6464
margin-top: 0;
6565
background-color: rgb(38, 26, 50);
66-
width: 60%;
66+
width: 70%;
6767
z-index: 3;
6868
left: -100vw;
6969
list-style-type: none;
@@ -74,9 +74,7 @@
7474

7575
#nav-columnar-menu.active {
7676
transition: all 0.8s ease-in;
77-
width: 60%;
7877
left: 0;
79-
8078
height: 100vh;
8179
}
8280

css/styles.css

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
background-color: rgb(9, 3, 15);
77
font-size: 25px;
88
scroll-behavior: smooth;
9+
-webkit-tap-highlight-color: rgba(0,0,0,0)
910
}
1011

1112
/* || GENERAL STYLES */
@@ -45,12 +46,6 @@ section {
4546

4647
}
4748

48-
.opacity-effect {
49-
filter: opacity(50%);
50-
-webkit-filter: opacity(50%) ;
51-
/* backdrop-filter: opacity(20%) grayscale(70%); */
52-
}
53-
5449

5550
article {
5651
padding: 2.5em;
@@ -74,6 +69,15 @@ i {
7469

7570

7671
/* || UTILITIES */
72+
.oscured{
73+
transition: all 0.3s ease-in;
74+
}
75+
.oscured.opacity-effect {
76+
filter: opacity(50%);
77+
-webkit-filter: opacity(50%) ;
78+
transition: all 0.8s ease-in;
79+
80+
}
7781

7882
.reveal {
7983
opacity: 0;
@@ -140,7 +144,9 @@ i {
140144
transition: all 0.5s ease-in-out;
141145

142146
}
143-
147+
.work-link:active{
148+
background-color: transparent;
149+
}
144150
.work-link:visited {
145151
color: var(--default-secundary-font-color);
146152
text-decoration-color: var(--default-secundary-font-color);
@@ -156,7 +162,9 @@ i {
156162
.icon-link {
157163
background-image: none;
158164
}
159-
165+
.icon-link:active{
166+
background-color: transparent;
167+
}
160168
.icon-link:link>i {
161169
background-size: 100% 100%;
162170
transition: all 0.5s ease-in-out;

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</ul>
5353
</nav>
5454
<nav class="navbar-compressed">
55-
<div class="nav-header-menu">
55+
<div class="nav-header-menu oscured">
5656
<a class="icon-link" id="show-nav-columnar-menu"><i class="fa fa-bars fa-xl"></i></a>
5757
</div>
5858
<ul id="nav-columnar-menu">
@@ -72,7 +72,7 @@
7272
</ul>
7373
</nav>
7474
</header>
75-
<main>
75+
<main class="oscured">
7676
<section>
7777
<div class="presentation centered-article">
7878
<h1 id="presentation-title">Hi, I am <br class='br-show'>Carlos Jorge!</h1>

index.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ function reveal() {
1313
window.addEventListener("scroll", reveal);
1414
function removeActive(navColumnarMenu) {
1515
navColumnarMenu.classList.remove("active");
16-
document.getElementsByTagName("main")[0].classList.remove("opacity-effect");
17-
document
18-
.getElementsByClassName("nav-header-menu")[0]
19-
.classList.remove("opacity-effect");
16+
[...document.getElementsByClassName('oscured')].forEach(
17+
(element)=>{
18+
element.classList.remove("opacity-effect");
19+
}
20+
)
2021
}
2122
function addActive(navColumnarMenu) {
2223
navColumnarMenu.classList.add("active");
23-
document.getElementsByTagName("main")[0].classList.add("opacity-effect");
24-
document
25-
.getElementsByClassName("nav-header-menu")[0]
26-
.classList.add("opacity-effect");
24+
[...document.getElementsByClassName('oscured')].forEach(
25+
(element)=>{
26+
element.classList.add("opacity-effect");
27+
}
28+
)
2729
}
2830
document.addEventListener("DOMContentLoaded", function (event) {
2931
[...document.getElementsByTagName("a")].forEach(function (element) {
@@ -44,8 +46,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
4446
if (
4547
ev.path.some(
4648
(element) =>
47-
element.tagName === "MAIN" ||
48-
element.classList?.contains("nav-header-menu")
49+
element.classList?.contains("oscured")
4950
)
5051
) {
5152
removeActive(navColumnarMenu);

0 commit comments

Comments
 (0)