Skip to content

Commit 3559a7f

Browse files
committed
rustdoc: animate the :target highlight
This approach is, roughly, based on how Discourse does it. It came up while discussing some other possible sidebar changes, as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing.
1 parent 5601d14 commit 3559a7f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+13
Original file line numberDiff line numberDiff line change
@@ -1547,10 +1547,23 @@ instead, we check that it's not a "finger" cursor.
15471547
margin-left: 24px;
15481548
}
15491549

1550+
@keyframes targetfadein {
1551+
from {
1552+
background-color: var(--main-background-color);
1553+
}
1554+
10% {
1555+
background-color: var(--target-border-color);
1556+
}
1557+
to {
1558+
background-color: var(--target-background-color);
1559+
}
1560+
}
1561+
15501562
:target {
15511563
padding-right: 3px;
15521564
background-color: var(--target-background-color);
15531565
border-right: 3px solid var(--target-border-color);
1566+
animation: 0.65s cubic-bezier(0, 0, 0.1, 1.0) 0.1s targetfadein;
15541567
}
15551568

15561569
.code-header a.tooltip {

0 commit comments

Comments
 (0)