mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-19 10:08:03 +08:00
fix:优化TOC功能
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
border-right: 2px solid #25b864;
|
||||
}
|
||||
|
||||
.article-body .markdown-article,.article-body .attach-list{
|
||||
.article-body .markdown-article{
|
||||
margin-right: 200px;
|
||||
}
|
||||
.markdown-toc-list .directory-item {
|
||||
|
@@ -3981,6 +3981,7 @@
|
||||
html = new String(html);
|
||||
}
|
||||
|
||||
html = '<article class="markdown-article-inner">' + html + "</article>";
|
||||
if (typeof filters !== "string") {
|
||||
return html;
|
||||
}
|
||||
|
@@ -149,11 +149,36 @@ $(function () {
|
||||
$('.manual-right').animate({ scrollTop: '0px' }, 200);
|
||||
});
|
||||
$(".manual-right").scroll(function () {
|
||||
var top = $(".manual-right").scrollTop();
|
||||
if (top > 100) {
|
||||
$(".view-backtop").addClass("active");
|
||||
} else {
|
||||
$(".view-backtop").removeClass("active");
|
||||
try {
|
||||
var top = $(".manual-right").scrollTop();
|
||||
if (top > 100) {
|
||||
$(".view-backtop").addClass("active");
|
||||
} else {
|
||||
$(".view-backtop").removeClass("active");
|
||||
}
|
||||
}catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
try{
|
||||
var scrollTop = $(document).scrollTop();
|
||||
var oItem = $(".markdown-heading").find(".reference-link");
|
||||
var oName = "";
|
||||
$.each(oItem,function(){
|
||||
var oneItem = $(this);
|
||||
var offsetTop = oneItem.offset().top;
|
||||
if(offsetTop-scrollTop < 200){
|
||||
oName = "#" + oneItem.attr("name");
|
||||
}
|
||||
});
|
||||
$(".markdown-toc-list a").each(function () {
|
||||
if(oName === $(this).attr("href")) {
|
||||
$(this).parents("li").addClass("directory-item-active");
|
||||
}else{
|
||||
$(this).parents("li").removeClass("directory-item-active");
|
||||
}
|
||||
});
|
||||
}catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
window.isFullScreen = false;
|
||||
|
Reference in New Issue
Block a user