Compare commits
4 Commits
0d442fb63a
...
5fb2abe818
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fb2abe818 | |||
| 1f3b646495 | |||
| a1ea5c6752 | |||
| beb86140a6 |
@@ -121,21 +121,27 @@
|
|||||||
// 内容
|
// 内容
|
||||||
// 清空标题列表
|
// 清空标题列表
|
||||||
$("#title-list ul").empty();
|
$("#title-list ul").empty();
|
||||||
// 提取 h1 标题
|
// 提取 h3 标题
|
||||||
var h1Titles = $("#rendered-content").find("h3");
|
var h1Titles = $("#rendered-content").find("h3");
|
||||||
h1Titles.each(function (index) {
|
// 只有当找到h3标题且内容不为空时才进行处理
|
||||||
var title = $(this);
|
if (h1Titles.length > 0) {
|
||||||
var titleText = title.text();
|
h1Titles.each(function (index) {
|
||||||
var titleId = "title-" + index;
|
var title = $(this);
|
||||||
title.attr("id", titleId);
|
var titleText = title.text().trim(); // 使用trim()去除空白字符
|
||||||
var listItem = $("<li>");
|
// 只有当标题文本不为空时才添加到列表
|
||||||
var link = $("<a>", {
|
if (titleText) {
|
||||||
href: "#" + titleId,
|
var titleId = "title-" + index;
|
||||||
text: titleText
|
title.attr("id", titleId);
|
||||||
|
var listItem = $("<li>");
|
||||||
|
var link = $("<a>", {
|
||||||
|
href: "#" + titleId,
|
||||||
|
text: titleText
|
||||||
|
});
|
||||||
|
listItem.append(link);
|
||||||
|
$("#title-list ul").append(listItem);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
listItem.append(link);
|
}
|
||||||
$("#title-list ul").append(listItem);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
@@ -173,6 +173,7 @@
|
|||||||
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li a.active {
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li a.active {
|
||||||
color: #1f2635;
|
color: #1f2635;
|
||||||
border-bottom: 1px solid #1f2635;
|
border-bottom: 1px solid #1f2635;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.narshelpdetailPc .nars-help-content .nars-hlpdt-mm {
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mm {
|
||||||
@@ -226,7 +227,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li {
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li {
|
||||||
margin-bottom: 23px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li a {
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li a {
|
||||||
|
|||||||
Reference in New Issue
Block a user