Skip to content

Anchor links in TOC don't scroll the page #1337

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

Closed
akbr opened this issue May 27, 2016 · 7 comments
Closed

Anchor links in TOC don't scroll the page #1337

akbr opened this issue May 27, 2016 · 7 comments

Comments

@akbr
Copy link

akbr commented May 27, 2016

Concise example here: https://akbr.gitbooks.io/anchor/content/

Code here: https://github.com/akbr/anchor-test

Any insight?

@SamyPesse
Copy link
Member

This is working for me on Safari (9.1.1 on El Capitan); if I click on "Anchor One" or "Anchor Two", it scrolls the page.

What browser are you using?

@akbr
Copy link
Author

akbr commented May 30, 2016

I'm using the most recent version of Chrome (v51.0.2704.63 m) on Windows 10.

To clarify: Clicking the anchor link doesn't scroll the page, but browsing directly to it (e.g., by clicking here: https://akbr.gitbooks.io/anchor/content/#one) does.

@SeaDude
Copy link

SeaDude commented Jun 5, 2016

Visiting https://akbr.gitbooks.io/anchor/content/, clicking on Anchor one or Anchor two in the TOC scrolls beautifully for me. Back and forth no problem.

Firefox on Ubuntu 16.04

@jeffmohr
Copy link

jeffmohr commented Jun 9, 2016

I'm getting the same issue on Chrome (Version 50.0.2661.102) with OS X 10.10.5.

This used to be workaround code but seems like it no longer does the trick with Gitbook V3.

var target = window.location.hash;

window.location.hash = "";

$(document).ready(function() {
    setTimeout(function() {
        document.location.hash = target;
    }, 50);
});

@jeffmohr
Copy link

jeffmohr commented Jun 9, 2016

@SamyPesse any chance the fancy slower scroll that is used when clicking on an anchor link in the summary might be the culprit? And is there a way to disable that functionality?

@jeffmohr
Copy link

jeffmohr commented Jun 9, 2016

Odd, just another thing I stumbled upon was disabling the "anchors" plugin and adding "heading-anchors" seemed to resolve things for me.

@SeaDude
Copy link

SeaDude commented Jun 11, 2016

If its any help: https://www.gitbook.com/book/seadude/linking/details

There are MANY ways to link in Gitbook

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

No branches or pull requests

5 participants