可选,(DIYer福利)设置自定义样式的 class 名称:
// Default UI
+})
可选,自定义的是否自动为文章页面创建打印样式。
const defaults = Outline.DEFAULTS
+let outline
+
+defaults.position = 'sticky'
+defaults.stickyHeight = 86
+defaults.parentElement = '#aside'
+defaults.scrollElement = '#main'
+defaults.homepage = './index.html'
+defaults.git = 'https://github.com/yaohaixiao/outline.js'
+defaults.tags = 'https://github.com/yaohaixiao/outline.js/tags'
+defaults.issues = 'https://github.com/yaohaixiao/outline.js/issues'
+defaults.print = {
+ element: '#article',
+ title: 'Outline.js 自动生成文章导读(Table of Contents)导航的 JavaScript 工具'
+}
+outline = new Outline(Outline.DEFAULTS)
可选,(DIYer福利)设置自定义样式的 class 名称:
// Default UI
new Outline(Outline.DEFAULTS)
// Customized
@@ -256,20 +271,28 @@
}
outline = new Outline(Outline.DEFAULTS)
outline.js 重构后,对外放 4 个重要的属性:anchors、drawer、chapters 和 toolbar。它们都是独立的对象实例,提供了 outline.js 所有的能力(属性和方法)。
静态属性,存储的是 Outline 对象默认配置选项:
Outline.DEFAULTS = {
articleElement: '#article',
- selector: 'h2,h3,h4,h5,h6',
- title: '目录',
- scrollElement: 'html,body',
- position: 'relative',
- parentElement: '#aside',
- placement: 'rtl',
- stickyHeight: 0,
- showCode: true,
- anchorURL: '',
- homepage: '',
- git: '',
- tags: '',
- issues: '',
- customClass: ''
+ selector: 'h2,h3,h4,h5,h6',
+ title: '目录',
+ scrollElement: 'html,body',
+ position: 'relative',
+ parentElement: '#aside',
+ placement: 'rtl',
+ showCode: true,
+ anchorURL: '',
+ stickyHeight: 0,
+ homepage: '',
+ git: '',
+ tags: '',
+ issues: '',
+ tools: [],
+ print: {
+ element: '',
+ title: ''
+ },
+ customClass: '',
+ afterSticky: null,
+ afterToggle: null,
+ afterScroll: null
}
存储的是 Outline 对象当前使用中的配置选项:
说明:建议使用 attr(prop) 方法来获取属性,避免直接调用属性。
// 设置默认配置项
const outline = new Outline(Outline.DEFAULTS)
diff --git a/docs/flex.html b/docs/flex.html
index c508b161..ab1dce2d 100644
--- a/docs/flex.html
+++ b/docs/flex.html
@@ -156,7 +156,22 @@
}
}
]
-})
可选,(DIYer福利)设置自定义样式的 class 名称:
// Default UI
+})
可选,自定义的是否自动为文章页面创建打印样式。
const defaults = Outline.DEFAULTS
+let outline
+
+defaults.position = 'sticky'
+defaults.stickyHeight = 86
+defaults.parentElement = '#aside'
+defaults.scrollElement = '#main'
+defaults.homepage = './index.html'
+defaults.git = 'https://github.com/yaohaixiao/outline.js'
+defaults.tags = 'https://github.com/yaohaixiao/outline.js/tags'
+defaults.issues = 'https://github.com/yaohaixiao/outline.js/issues'
+defaults.print = {
+ element: '#article',
+ title: 'Outline.js 自动生成文章导读(Table of Contents)导航的 JavaScript 工具'
+}
+outline = new Outline(Outline.DEFAULTS)
可选,(DIYer福利)设置自定义样式的 class 名称:
// Default UI
new Outline(Outline.DEFAULTS)
// Customized
@@ -262,20 +277,28 @@
}
outline = new Outline(Outline.DEFAULTS)
outline.js 重构后,对外放 4 个重要的属性:anchors、drawer、chapters 和 toolbar。它们都是独立的对象实例,提供了 outline.js 所有的能力(属性和方法)。
静态属性,存储的是 Outline 对象默认配置选项:
Outline.DEFAULTS = {
articleElement: '#article',
- selector: 'h2,h3,h4,h5,h6',
- title: '目录',
- scrollElement: 'html,body',
- position: 'relative',
- parentElement: '#aside',
- placement: 'rtl',
- stickyHeight: 0,
- showCode: true,
- anchorURL: '',
- homepage: '',
- git: '',
- tags: '',
- issues: '',
- customClass: ''
+ selector: 'h2,h3,h4,h5,h6',
+ title: '目录',
+ scrollElement: 'html,body',
+ position: 'relative',
+ parentElement: '#aside',
+ placement: 'rtl',
+ showCode: true,
+ anchorURL: '',
+ stickyHeight: 0,
+ homepage: '',
+ git: '',
+ tags: '',
+ issues: '',
+ tools: [],
+ print: {
+ element: '',
+ title: ''
+ },
+ customClass: '',
+ afterSticky: null,
+ afterToggle: null,
+ afterScroll: null
}
存储的是 Outline 对象当前使用中的配置选项:
说明:建议使用 attr(prop) 方法来获取属性,避免直接调用属性。
// 设置默认配置项
const outline = new Outline(Outline.DEFAULTS)
@@ -938,4 +961,8 @@
defaults.git = 'https://github.com/yaohaixiao/outline.js'
defaults.tags = 'https://github.com/yaohaixiao/outline.js/tags'
defaults.issues = 'https://github.com/yaohaixiao/outline.js/issues'
+defaults.print = {
+ element: '#article',
+ title: 'Outline.js 自动生成文章导读(Table of Contents)导航的 JavaScript 工具'
+}
outline = new Outline(Outline.DEFAULTS)