Skip to content

Commit 2cc48c7

Browse files
committed
consolidate code in fragment jumper
1 parent d106410 commit 2cc48c7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/js/03-fragment-jumper.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
}
1010

1111
function computePosition (el, sum) {
12-
if (article.contains(el)) {
13-
return computePosition(el.offsetParent, el.offsetTop + sum)
14-
} else {
15-
return sum
16-
}
12+
return article.contains(el) ? computePosition(el.offsetParent, el.offsetTop + sum) : sum
1713
}
1814

1915
function jumpToAnchor (e) {

0 commit comments

Comments
 (0)