Skip to content

Commit 9138822

Browse files
committed
use height from bounding client rect instead of clientHeight to determine if nav panel is scrollable
1 parent a1d8fde commit 9138822

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/js/01-nav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@
146146
}
147147

148148
function scrollItemToMidpoint (panel, item) {
149-
if (panel.scrollHeight === panel.clientHeight) return // not scrollable
150149
var panelRect = panel.getBoundingClientRect()
150+
if (panel.scrollHeight === Math.round(panelRect.height)) return // not scrollable
151151
var linkRect = item.querySelector('.nav-link').getBoundingClientRect()
152152
panel.scrollTop += Math.round(linkRect.top - panelRect.top - (panelRect.height - linkRect.height) * 0.5)
153153
}

0 commit comments

Comments
 (0)