Skip to content

Commit

Permalink
Refactor out handleChangeInActiveItem
Browse files Browse the repository at this point in the history
  • Loading branch information
colinbm committed Jul 14, 2021
1 parent 2f0a9a6 commit bb70a4a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/assets/javascripts/_modules/in-page-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@
fragment = fragmentForFirstElementInView()
}

handleChangeInActiveItem(fragment, true)
highlightActiveItemInToc(fragment)
}

function handleScrollEvent () {
handleChangeInActiveItem(fragmentForFirstElementInView())
}
var fragment = fragmentForFirstElementInView()

function handleChangeInActiveItem (fragment, skipHistory) {
!skipHistory && storeCurrentPositionInHistoryApi(fragment)
storeCurrentPositionInHistoryApi(fragment)
highlightActiveItemInToc(fragment)
}

Expand Down

0 comments on commit bb70a4a

Please sign in to comment.