Skip to content

v1.2.4

Compare
Choose a tag to compare
@gadzan gadzan released this 23 Jun 01:55
· 15 commits to master since this release

v1.2.4 Change log

  1. New parameter scrollOffset in generatoc.init(), default to 0. It could scroll to the target with a vertical offset(pixel). If you have a fixed header in your page, this is what you need to set.

  2. New parameter duration in generatoc.init(), default to 7. The duration of scroll animation, a larger number means slower scroll. It accepts a number large than 1.

Sample:

const scrollOffset = 64 // Scroll to position where 64 pixel distant top of the target.
const duration = 3 // Faster scrolling.

const content = '.post-content'
const heading = ['h2', 'h3', 'h4', 'h5']
const selector = '#toc'
generatoc.init({ content, heading, selector, scrollOffset, duration })