finding toc

This commit is contained in:
Van
2016-10-13 00:24:04 +08:00
parent 72b70b53d6
commit 511da4114b
11 changed files with 444 additions and 20 deletions

View File

@@ -17,7 +17,7 @@
* @fileoverview util and every page should be used.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.0, Jun 13, 2015
* @version 1.1.0.0, Oct 13, 2016
*/
/**
@@ -30,6 +30,7 @@ var Finding = {
*/
init: function () {
Util.killIE();
this._initToc();
$(".scroll-down").click(function (event) {
event.preventDefault();
@@ -63,6 +64,38 @@ var Finding = {
}
});
},
/**
* 文章目录
* @returns {undefined}
*/
_initToc: function () {
if ($('.b3-solo-list').length === 0) {
$('.nav .icon-sitemap, .nav .icon-list').show();
return false;
}
$('.nav .icon-sitemap, .nav .icon-list').show();
$('.nav ul:first').hide();
$('.nav ul:first').after($('.b3-solo-list'));
$("body").toggleClass("nav-opened nav-closed");
},
tabNav: function (type) {
$('.nav .current').removeClass('current');
if (type === 'toc') {
$('.nav ul:first').hide();
$('.nav ul:last').show();
$('.icon-list').addClass('current');
} else {
$('.nav ul:first').show();
$('.nav ul:last').hide();
$('.icon-sitemap').addClass('current');
}
},
/**
* 分享
* @returns {undefined}
*/
share: function () {
$(".share span").click(function () {
var key = $(this).data("type");