Skip to content

Commit d3365f0

Browse files
Added tooltip with some styling
1 parent d4a326e commit d3365f0

3 files changed

Lines changed: 58 additions & 1 deletion

File tree

‎app.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,5 @@ document.addEventListener("click", (e) => {
354354

355355
book.classList.toggle("tap-effect");
356356
if (overlay) overlay.classList.toggle("tap-overlay");
357-
});
357+
});
358+

‎index.html‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@
3030
<i class="fa-solid fa-search search-icon"></i>
3131
</div>
3232
<nav class="nav-links">
33+
<div class="tooltip">
3334
<a href="index.html" class="active">Discovery</a>
35+
<span class="tooltip-text"><i class="fa-solid fa-wand-magic-sparkles"></i> </span>
36+
</div>
37+
<div class="tooltip">
3438
<a href="library.html">My Library</a>
39+
<span class="tooltip-text"><i class="fa-solid fa-book"></i> </span>
40+
</div>
41+
<div class="tooltip">
3542
<a href="auth.html">Sign In</a>
43+
<span class="tooltip-text"><i class="fa-solid fa-key"></i> </span>
44+
</div>
3645
</nav>
3746
<button id="themeToggle" class="btn-icon" title="Toggle Theme">
3847
<i class="fa-solid fa-moon"></i>

‎style.css‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,3 +621,50 @@ main {
621621
font-size: 0.7rem;
622622
}
623623
}
624+
625+
/* tooltip */
626+
.tooltip {
627+
position: relative;
628+
display: inline-block;
629+
}
630+
631+
.tooltip-text {
632+
position: absolute;
633+
left: 50%;
634+
bottom: calc(100% + 8px);
635+
transform: translateX(-50%) scale(0.95) translateY(6px);
636+
padding: 10px 14px;
637+
background: #fffaf3;
638+
color: #2b2b2b;
639+
font-size: 13px;
640+
font-weight: 500;
641+
white-space: nowrap;
642+
border-radius: 10px;
643+
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
644+
border: 1px solid rgba(0,0,0,0.08);
645+
opacity: 0;
646+
visibility: hidden;
647+
pointer-events: none;
648+
transition: all 0.25s ease;
649+
z-index: 9999;
650+
}
651+
652+
.tooltip-text::after {
653+
content: "";
654+
position: absolute;
655+
top: 100%;
656+
left: 50%;
657+
transform: translateX(-50%) rotate(45deg);
658+
width: 12px;
659+
height: 12px;
660+
background: #fffaf3;
661+
border-left: 1px solid rgba(0,0,0,0.08);
662+
border-bottom: 1px solid rgba(0,0,0,0.08);
663+
}
664+
665+
.tooltip:hover .tooltip-text {
666+
opacity: 1;
667+
visibility: visible;
668+
transform: translateX(-40%) scale(1) translateY(0);
669+
}
670+

0 commit comments

Comments
 (0)