" + `${xuhao}. `
// 检查 refer_frag 中是否包含 "Available at:"
if (result.data.refers[rr].refer_frag.indexOf('Available at:') !== -1) {
// 如果包含 "Available at:",则在其前面插入
标签
@@ -7782,8 +7875,140 @@ function article_con() {
}
}
// 将生成的所有引用内容插入到页面中
- $('.wen_rong .content-box .conthtmn').append('
');
+ $('.wen_rong .content-box .conthtmn').append('
');
}
+ $('.wen_rong .content-box .conthtmn').prepend(navHtml);
+ // 给导航栏添加固定定位样式
+ // 给导航栏添加固定定位样式
+ $('.anchor-nav').css({
+ 'position': 'fixed',
+ 'display': 'none',
+ 'top': '0', // 固定在顶部
+ 'left': '0', // 固定在左侧
+ 'width': '285px', // 设置固定宽度
+ 'background': '#ffffff', // 背景色
+
+ // 'border-radius': '12px', // 圆角效果
+ 'box-shadow': '0 4px 8px rgba(0, 0, 0, 0.1)', // 阴影效果
+ 'z-index': '999', // 确保导航栏位于其他元素之上
+ 'overflow-y': 'auto', // 允许垂直滚动
+ 'height': '100vh', // 让导航栏充满整个页面高度
+ 'position': 'sticky', /* 固定定位 */
+ 'float': 'left', /* 固定定位 */
+ /* 导航栏顶部距离为0 */
+ 'box-shadow': '2px 0 5px rgba(0, 0, 0, 0.1)',
+ });
+ $('.jo-catalog-title').css({
+
+
+ 'line-height': '40px',
+ 'font-size': '18px',
+ 'color': '#333',
+ 'border-bottom': '1px solid #f0f0f0',
+
+ });
+ $('.outiline-item').css({
+
+
+ 'border-bottom': '1px solid #fff',
+ // 'margin-bottom': '10px',
+ 'box-sizing': 'border-box',
+
+ 'font-size': '14px',
+ 'color': '#454545',
+ 'cursor': 'pointer',
+ });
+ $('.outiline-content').css({
+ 'padding': '4px 0',
+ 'margin-left': '16px',
+
+ 'color': '#333',
+ 'cursor': 'pointer',
+ 'font-family': 'Charis SIL',
+ // 'border-left': '3px solid #efefef',
+
+ });
+
+ $('.outiline-img').css({
+
+ 'margin-top': '20px',
+ 'margin-bottom': '20px',
+ // 'border-left': '3px solid #efefef',
+
+ });
+ $('.outiline-table').css({
+
+ 'margin-top': '20px',
+ 'margin-bottom': '20px',
+
+ // 'border-left': '3px solid #efefef',
+
+ });
+ $('.navLinksFigures').css({
+ 'display': 'flex',
+ 'flex-wrap': 'wrap',
+ 'gap': '10px',
+
+ 'margin-bottom': '10px',
+ 'margin-top': '10px',
+
+ });
+ $('.navLinksTables').css({
+ 'display': 'flex',
+ 'flex-wrap': 'wrap',
+ 'gap': '4px',
+
+ 'margin-bottom': '10px',
+ 'margin-top': '10px',
+
+ });
+
+ // 在滚动时保持导航栏在视口内
+
+ $(document).ready(function () {
+ // 监听右侧滚动区域
+ $('.newBox').scroll(function () {
+ var scrollTop = $(this).scrollTop(); // 获取当前右侧滚动的位置
+ var scrollHeight = $(this)[0].scrollHeight; // 获取右侧滚动区域的总高度
+ var containerHeight = $(this).height(); // 获取右侧容器的高度
+
+ // 获取所有右侧的 .pMain
+ var sections = $('.newBox').find('.pMain');
+ var navLinks = $('.anchor-nav').find('a'); // 获取所有左侧的导航链接
+
+ // 初始化清除所有导航链接的高亮
+ navLinks.css({
+ 'color': '', // 恢复默认颜色
+ 'font-weight': '' // 恢复默认字体粗细
+ });
+
+ // 遍历所有的 section
+ sections.each(function (index, section) {
+ var sectionTop = $(section).offset().top - $('.newBox').offset().top + scrollTop; // 计算每个 .pMain 相对于 .newBox 的位置
+ var sectionBottom = sectionTop + $(section).outerHeight(); // 获取每个 section 的底部位置
+
+ // 判断该 section 是否在可视区域内
+ if (scrollTop + containerHeight >= sectionTop && scrollTop <= sectionBottom) {
+ // 高亮对应的导航链接
+ $(navLinks[index]).css({
+ 'color': 'rgb(0, 102, 153)', // 激活时颜色变为蓝色
+ 'font-weight': 'bold' // 激活时加粗
+ });
+ // 只高亮一个链接,找到第一个符合条件的并停止遍历
+ return false; // 结束 .each() 遍历
+ }
+ });
+ });
+ });
+
+
+
+
+
+
+
+
+
}
},
diff --git a/js/js.js b/js/js.js
index 6b1113e..fc921b4 100644
--- a/js/js.js
+++ b/js/js.js
@@ -52,13 +52,31 @@ var Jour_num = localStorage.Journals_num;
$(document).ready(function () {
$("#tablist li").each(function (index) {
$(this).click(function () {
+ console.log('this at line 54:', this);
+
+ // 移除所有的 contentin 和 tabin 类
$(".contentin").removeClass("contentin");
$(".tabin").removeClass("tabin");
+
+ // 添加 contentin 和 tabin 类
$(".content-box>div").eq(index).addClass("contentin");
- $(this).addClass("tabin")
+ $(this).addClass("tabin");
+
+ // 判断当前点击的
是否具有 'tarhtmn' 类名
+ if ($(this).hasClass('tarhtmn')) {
+ // 设置当前点击的 宽度为 100%
+ $(".left").css("width", "100%");
+ $(".right").hide(); // 隐藏 .right 标签
+ } else {
+ // 移除当前点击的 宽度样式
+ $(".left").css("width", "");
+ $(".right").show(); // 恢复显示 .right 标签
+ }
});
- })
-})
+ });
+});
+
+
//返回顶部
@@ -203,7 +221,7 @@ function imgbig1(which) {
imgsrc = imgsrc.replace(/^url\(["']?/, '').replace(/["']?\)$/, ''); // 处理 URL 去掉多余字符
-
+
$("#bigimg").css("display", "block");
$("#bigimg").html("
");
$('#bigimg>img').css('margin-top', -$('#bigimg>img').height() / 2);