toml-lang / toml.io

Source Code for toml.io
https://toml.io
MIT License
42 stars 44 forks source link

Fix navigation when window is zoomed #73

Closed arp242 closed 1 year ago

arp242 commented 1 year ago

In Firefox when zoomed to 120%, clicking on a menu item on /en/v1.0.0.html will highlight the entry above it, rather than the entry we clicked on.

the problem is that the scroll value may not be a full pixel anymore, for example after clicking "Integer":

console.log(target, target.offsetTop, window.scrollY)
// <h2 id="string"  data-target="nav.header"> 5828 9511.6669921875
// <h2 id="integer" data-target="nav.header"> 9512 9511.6669921875

Doing a Math.ceil() fixes it. Round is not enough as some values are below .5

cannikin commented 1 year ago

Thank you!