Optimized JS to hide empty ToC.
This commit is contained in:
parent
75b825cdde
commit
0e6edb0d1a
2 changed files with 7 additions and 4 deletions
|
@ -6,8 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
// Hide ToC title if there is no head
|
if ($("#post-wrap .post-content h1").length == 0
|
||||||
if ($("#toc-wrap>nav#toc>ul>li").length == 0) {
|
&& $("#post-wrap .post-content h2").length == 0
|
||||||
$("#toc-wrap>h3").addClass("hidden");
|
&& $("#post-wrap .post-content h3").length == 0
|
||||||
|
&& $("#post-wrap .post-content h4").length == 0
|
||||||
|
&& $("#post-wrap .post-content h5").length == 0) {
|
||||||
|
$("#toc-wrap").addClass("hidden");
|
||||||
}
|
}
|
||||||
});
|
});
|
2
assets/js/dist/toc.min.js
vendored
2
assets/js/dist/toc.min.js
vendored
|
@ -1 +1 @@
|
||||||
$(function(){if($("#toc-wrap>nav#toc>ul>li").length==0){$("#toc-wrap>h3").addClass("hidden")}});
|
$(function(){if($("#post-wrap .post-content h1").length==0&&$("#post-wrap .post-content h2").length==0&&$("#post-wrap .post-content h3").length==0&&$("#post-wrap .post-content h4").length==0&&$("#post-wrap .post-content h5").length==0){$("#toc-wrap").addClass("hidden")}});
|
Loading…
Reference in a new issue