08-27-周三_17-09-29
This commit is contained in:
27
node_modules/gitbook-plugin-toggle-chapters/book/toggle.js
generated
vendored
Normal file
27
node_modules/gitbook-plugin-toggle-chapters/book/toggle.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
require(["gitbook", "jQuery"], function(gitbook, $) {
|
||||
|
||||
function expand(chapter) {
|
||||
chapter.show();
|
||||
if (chapter.parent().attr('class') != 'summary'
|
||||
&& chapter.parent().attr('class') != 'book-summary'
|
||||
&& chapter.length != 0
|
||||
) {
|
||||
expand(chapter.parent());
|
||||
}
|
||||
}
|
||||
|
||||
gitbook.events.bind("page.change", function() {
|
||||
$('li.chapter').children('ul.articles').hide();
|
||||
$chapter = $('li.chapter.active');
|
||||
$children = $chapter.children('ul.articles');
|
||||
$parent = $chapter.parent();
|
||||
$siblings = $chapter.siblings().children('ul.articles');
|
||||
|
||||
expand($chapter);
|
||||
|
||||
if ($children.length > 0) {
|
||||
$children.show();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user