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

If you use headers in the sidebar ToC will scroll to that instead of the one in the page #166

Closed
HanPrower opened this issue Mar 11, 2016 · 1 comment

Comments

@HanPrower
Copy link

For example if you set a header in the sidebar to be called "Cake" and there's a section in your page with the header "Cake" clicking the "Cake" link in the ToC will scroll to the sidebar instead of the page.

Really it's a mild failing on Dokuwiki's side because they should probably be prefixing headers in the sidebar with sidebar_ to avoid duplicate IDs in a page... They shouldn't expect an end user to know proper web standards ;)

Regardless, I fixed this to a degree with this theme by changing in js/template.js:

      var body_offset      = (parseInt(jQuery('body').css('paddingTop')) || 0),
          section_position = (jQuery(jQuery.attr(this, 'href')).offset().top - body_offset);

to

      var body_offset      = (parseInt(jQuery('body').css('paddingTop')) || 0),
          section_position = (jQuery('#dokuwiki__content ' + jQuery.attr(this, 'href')).offset().top - body_offset + 10);

It's not perfect though and probably highly flawed knowing me...

@giterlizzi
Copy link
Owner

Resolved issue

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

2 participants