Skip to content

Commit 2fa4f3d

Browse files
Add author hover tooltips with styling to show the name of the author
1 parent d8f7e0b commit 2fa4f3d

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

docs/extra.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,43 @@
258258
[data-md-color-scheme="slate"] .graph-reset-btn:hover {
259259
background: rgba(60, 60, 60, 1);
260260
}
261+
262+
/* Blog preview author hover tooltip */
263+
.md-author {
264+
position: relative;
265+
cursor: pointer;
266+
}
267+
268+
.md-author:hover {
269+
background: rgba(0, 0, 0, 0.08);
270+
transform: translateY(-1px);
271+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
272+
}
273+
274+
.md-author img {
275+
width: 36px;
276+
height: 36px;
277+
border-radius: 50%;
278+
object-fit: fill;
279+
border: 1px solid rgba(0, 0, 0, 0.1);
280+
}
281+
282+
.md-author img:hover {
283+
transform: scale(1.1);
284+
transition: transform 0.2s ease;
285+
}
286+
287+
/* Dark mode adjustments */
288+
[data-md-color-scheme="slate"] .md-author {
289+
background: rgba(255, 255, 255, 0.1);
290+
border: 1px solid rgba(255, 255, 255, 0.1);
291+
}
292+
293+
[data-md-color-scheme="slate"] .md-author:hover {
294+
background: rgba(255, 255, 255, 0.15);
295+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
296+
}
297+
298+
[data-md-color-scheme="slate"] .md-author img {
299+
border-color: rgba(255, 255, 255, 0.2);
300+
}

docs/js/author-tooltips.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Add title attributes to author images for tooltips
2+
document.addEventListener('DOMContentLoaded', function() {
3+
// Find all author images in blog previews
4+
const authorImages = document.querySelectorAll('.md-post__authors .md-author img');
5+
6+
authorImages.forEach(img => {
7+
// If image has alt text but no title, copy alt to title
8+
if (img.alt && !img.title) {
9+
img.title = img.alt;
10+
}
11+
});
12+
});

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ extra_javascript:
7979
- https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/loader.min.js
8080
- js/jac.monarch.js
8181
- js/run-code.js
82+
- js/author-tooltips.js
8283

8384
plugins:
8485
- search

0 commit comments

Comments
 (0)