File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 150
150
e . stopPropagation ( )
151
151
}
152
152
153
- function scrollItemToMidpoint ( panel , el ) {
154
- var rect = panel . getBoundingClientRect ( )
155
- var effectiveHeight = rect . height
156
- var navStyle = window . getComputedStyle ( nav )
157
- if ( navStyle . position === 'sticky' ) effectiveHeight -= rect . top - parseFloat ( navStyle . top )
158
- panel . scrollTop = Math . max ( 0 , ( el . getBoundingClientRect ( ) . height - effectiveHeight ) * 0.5 + el . offsetTop )
153
+ function scrollItemToMidpoint ( panel , item ) {
154
+ var itemRect = item . getBoundingClientRect ( )
155
+ var panelRect = panel . getBoundingClientRect ( )
156
+ var currentOffsetTop = itemRect . top - panelRect . top + panel . scrollTop
157
+ var targetOffsetTop = ( panelRect . height - itemRect . height ) * 0.5
158
+ panel . scrollTop = Math . max ( 0 , ( currentOffsetTop - targetOffsetTop ) . toFixed ( ) )
159
159
}
160
160
161
161
function find ( from , selector ) {
You can’t perform that action at this time.
0 commit comments