Skip to content

Commit

Permalink
feat: spin github star once on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
agrmohit committed Aug 30, 2024
1 parent 429fe89 commit b10e649
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,22 @@ p:hover .emoji-wave {
transform: rotate(0deg);
}
}

.emoji-rotate {
display: inline-block;
}

span:hover .emoji-rotate {
animation-name: spin-animation;
animation-duration: 3s;
animation-iteration-count: 1;
}

@keyframes spin-animation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
4 changes: 3 additions & 1 deletion assets/js/script-stars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ async function GitHubStars() {
}

if (stars) {
h3.innerHTML = h3.innerHTML.trim().replace("<a", ` <span title="${stars} GitHub stars">(${stars}⭐)</span><a`);
h3.innerHTML = h3.innerHTML
.trim()
.replace("<a", ` <span title="${stars} GitHub stars">(${stars}<span class="emoji-rotate">⭐</span>)</span><a`);
}
}

Expand Down

0 comments on commit b10e649

Please sign in to comment.