Skip to content

Commit 9cb4102

Browse files
committed
use Math.round instead of toFixed()
1 parent 6c26862 commit 9cb4102

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/01-nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
var padding = parseFloat(window.getComputedStyle(this).marginTop)
9393
var rect = this.getBoundingClientRect()
9494
var menuPanelRect = menuPanel.getBoundingClientRect()
95-
var overflowY = (rect.bottom - menuPanelRect.top - menuPanelRect.height + padding).toFixed()
96-
if (overflowY > 0) menuPanel.scrollTop += Math.min((rect.top - menuPanelRect.top - padding).toFixed(), overflowY)
95+
var overflowY = Math.round(rect.bottom - menuPanelRect.top - menuPanelRect.height + padding)
96+
if (overflowY > 0) menuPanel.scrollTop += Math.min(Math.round(rect.top - menuPanelRect.top - padding), overflowY)
9797
}
9898
}
9999

0 commit comments

Comments
 (0)