You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing in Chrome and I find myself having to use {offset: 2} because:
I have <h1 id="someHeader">...</h1>. When I go to #someHeader:
pageYOffset = 8151
nav.distance = 8152
document.getElementById("Testing").getBoundingClientRect().top = 0.859375
I didn't have time to dig in but I think there is some sub-pixel issue here causing it to round up to 8152.
The code: if ( nav.distance < position ) { Shouldn't this be <= not <?
With an offset of 2, 8152 becomes 8150 and can pass the nav.distance < position check which makes it so that navigating to #someHeader actually highlights the right nav element.
The text was updated successfully, but these errors were encountered:
Hey there,
I'm testing in Chrome and I find myself having to use {offset: 2} because:
<h1 id="someHeader">...</h1>
. When I go to #someHeader:I didn't have time to dig in but I think there is some sub-pixel issue here causing it to round up to 8152.
if ( nav.distance < position ) {
Shouldn't this be<=
not<
?With an offset of 2, 8152 becomes 8150 and can pass the
nav.distance < position
check which makes it so that navigating to #someHeader actually highlights the right nav element.The text was updated successfully, but these errors were encountered: