From 27c4a4f72b8af80c8a6a7ee36d2c5c6ce46ce33c Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sun, 20 Dec 2020 17:00:22 -0700 Subject: [PATCH] consolidate code in fragment jumper --- src/js/03-fragment-jumper.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/js/03-fragment-jumper.js b/src/js/03-fragment-jumper.js index 5f9462a..68f580d 100644 --- a/src/js/03-fragment-jumper.js +++ b/src/js/03-fragment-jumper.js @@ -9,11 +9,7 @@ } function computePosition (el, sum) { - if (article.contains(el)) { - return computePosition(el.offsetParent, el.offsetTop + sum) - } else { - return sum - } + return article.contains(el) ? computePosition(el.offsetParent, el.offsetTop + sum) : sum } function jumpToAnchor (e) { -- 2.11.0