Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="#id">See chapter ID</a>
- <h2 id="chapter1">Chapter 1</h2>
- <p>Your paragraphs</p>
- <p> ... </p>
- <a href="#chapter2">See chapter 2</a>
- <h2 id="chapter2">Chapter 2</h2>
- <p>Your paragraphs</p>
- <p> ... </p>
- <a href="#chapter1">See chapter 1</a>
- $(document).ready(function() {
- var link = $('#linkId');
- var chapter = $('#chapterId');
- var position = chapter.position(); // according to jQuery api
- var offsetTop = position.top; // this should be the absolute offset of the page's top
- // Calls the tocify method on your HTML elements.
- link.tocify();
- chapter.tocify();
- //Call the tocify method with options
- link.tocify({
- showEffect: "fadeIn"
- scrollTo: offsetTop,
- smoothScroll: false
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement