Skip to content

Commit cfadd85

Browse files
committed
✨ Add zoom on hover to home page's thumbnails
1 parent ebc898f commit cfadd85

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

TestArena/Blog/Common/Thumbnail.razor

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<style>
1212
.custom-size {
1313
max-width: 400px;
14+
/* keep overflow hidden so the scaled card doesn't overflow layout */
15+
overflow: hidden;
1416
}
1517
.thumbnail-img {
1618
width: 100%;
@@ -19,10 +21,29 @@
1921
border-radius: 0.375rem 0.375rem 0 0;
2022
background: #f8f9fa;
2123
display: block;
24+
/* smooth filter transition for image brighten */
25+
transition: filter 250ms ease;
26+
}
27+
28+
/* Slight zoom of the whole component on hover */
29+
.thumbnail-card {
30+
transition: transform 220ms ease, box-shadow 220ms ease;
31+
transform-origin: center center;
32+
will-change: transform;
33+
}
34+
35+
.thumbnail-card:hover {
36+
transform: scale(1.04);
37+
box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.12);
38+
}
39+
40+
/* Subtle image brighten on hover */
41+
.thumbnail-card:hover .thumbnail-img {
42+
filter: brightness(1.04);
2243
}
2344
</style>
2445

25-
<div class="card shadow-sm custom-size">
46+
<div class="card shadow-sm custom-size thumbnail-card">
2647
<a href="@BlogUrl">
2748
<img src="@ImageUrl" class="thumbnail-img" alt="@Title">
2849
</a>

0 commit comments

Comments
 (0)