Skip to content

Commit d751327

Browse files
committed
Merge branch 'master' of git://github.com/hexpm/diff
2 parents 343a440 + 87679e5 commit d751327

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

assets/css/app.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ input.search-input:focus {
163163
padding: 10px;
164164
border-bottom: 0.1rem solid #e1e1e1;
165165
cursor: pointer;
166+
background: #fff;
167+
position: -webkit-sticky;
168+
position: sticky;
169+
top: 0px;
170+
z-index: 1;
166171
}
167172

168173
.ghd-file-header .reveal-diff {

assets/js/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ fileHeaders.forEach(header => {
5050
parent.querySelectorAll('.ghd-diff').forEach(diff => {
5151
diff.classList.toggle('hidden')
5252
})
53-
header.classList.toggle('collapsed')
53+
header.classList.toggle('collapsed') && scrollIfNeeded(header)
5454
})
5555
})
56+
57+
const scrollIfNeeded = elem => {
58+
elem.getBoundingClientRect().top < 0 && elem.scrollIntoView(true)
59+
}

0 commit comments

Comments
 (0)