Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offset required #35

Closed
altano opened this issue Apr 8, 2016 · 2 comments
Closed

offset required #35

altano opened this issue Apr 8, 2016 · 2 comments
Labels

Comments

@altano
Copy link
Contributor

altano commented Apr 8, 2016

Hey there,

I'm testing in Chrome and I find myself having to use {offset: 2} because:

  1. I have <h1 id="someHeader">...</h1>. When I go to #someHeader:
    1. pageYOffset = 8151
    2. nav.distance = 8152
    3. 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.
  2. 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.

@cferdinandi
Copy link
Owner

You're absolutely right. Thanks for this! Will get this knocked out.

@cferdinandi cferdinandi added the bug label Apr 8, 2016
@cferdinandi
Copy link
Owner

Will be addressed in #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants