Skip to content

Commit c09eb56

Browse files
committed
Added ripple effect on buttons
and scrollbar on projects
1 parent dba24c5 commit c09eb56

File tree

5 files changed

+138
-14
lines changed

5 files changed

+138
-14
lines changed

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,18 @@ <h1>Hi, I'm Salman</h1>
9090
</div>
9191
</div>
9292
<div class="links">
93-
<a href="{{githubUrl}}">Github Link</a>
93+
<div class="link">
94+
<a href="{{githubUrl}}">Github Link</a>
95+
</div>
9496
{{#url}}
97+
<div class="link">
9598
<a href="{{url}}">Visit Site</a>
99+
</div>
96100
{{/url}}
97101
</div>
98102
</div>
99103
</script>
100104
<script src="https://unpkg.com/mustache@latest"></script>
101-
<script src="./main.js"></script>
102105
<script src="./projects.js"></script>
106+
<script src="./main.js"></script>
103107
</html>

main.css

Lines changed: 71 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.scss

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,20 @@ nav {
138138
flex-wrap: wrap;
139139
flex-direction: column;
140140
width: 25%;
141-
overflow-y: scroll;
141+
overflow-y: hidden;
142142
scroll-snap-type: x mandatory;
143143
height: 500px;
144-
scrollbar-width: none;
144+
scrollbar-width: thin;
145+
scrollbar-color: var(--border-color) transparent;
145146
&::-webkit-scrollbar {
146-
display: none;
147+
height: 5px;
148+
background-color: transparent;
147149
}
150+
&::-webkit-scrollbar-thumb {
151+
border-radius: 10px;
152+
background-color: var(--border-color);
153+
}
154+
148155
}
149156
.project {
150157
display: flex;
@@ -169,13 +176,33 @@ nav {
169176
font-weight: bolder;
170177
}
171178
.links {
172-
margin: 30px auto 20px auto;
179+
display: flex;
180+
margin: 30px auto 20px auto;
173181
}
174-
a {
182+
.link {
175183
border: 1px solid var(--border-color);
176-
padding: 10px;
184+
position: relative;
177185
border-radius: 5px;
178186
margin: 0 5px;
187+
overflow: hidden;
188+
cursor: pointer;
189+
user-select: none;
190+
a {
191+
display: block;
192+
padding: 10px;
193+
}
194+
.ripple {
195+
position: absolute;
196+
background-color: var(--border-color);
197+
opacity: .5;
198+
height: 250px;
199+
width: 250px;
200+
border-radius: 50%;
201+
pointer-events: none;
202+
border: 1px solid var(--border-color);
203+
animation: ripple 1.5s;
204+
transform: translate(-50%, -50%);
205+
}
179206
}
180207
}
181208
}
@@ -203,6 +230,20 @@ nav {
203230
}
204231
}
205232
}
233+
@keyframes ripple {
234+
0% {
235+
height: 0px;
236+
width: 0px;
237+
opacity: 1;
238+
}
239+
80% {
240+
height: 250px;
241+
width: 250px;
242+
}
243+
100% {
244+
opacity: 0;
245+
}
246+
}
206247

207248

208249
@media (max-width: 768px){

projects.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,17 @@ request.onload = () => {
3030
projectList.innerHTML += rendered
3131
}
3232
});
33+
linkBtn = document.querySelectorAll(".project .links .link")
34+
ripple = document.createElement("div")
35+
ripple.classList.add("ripple")
36+
linkBtn.forEach(link => {
37+
link.addEventListener("click", function (e) {
38+
ripple.style.left = e.layerX + "px"
39+
ripple.style.top = e.layerY + "px"
40+
e.target.appendChild(ripple)
41+
ripple.addEventListener("animationend", ()=>{
42+
ripple.remove()
43+
})
44+
})
45+
})
3346
}

0 commit comments

Comments
 (0)