修复懒加载菜单展开问题 #18

Merged
cxykevin merged 1 commits from :main into main 2024-08-12 16:03:00 +08:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit ff8ffa0fd1 - Show all commits

View File

@ -68,9 +68,10 @@
<mdui-button class="hideonmobile" id="open-study-env">实验环境</mdui-button>
<mdui-top-app-bar-title>{{ book_title }}</mdui-top-app-bar-title>
<div style="flex-grow: 1"></div>
<div class="navbtn" style="display: flex;">
{{#previous}}
<mdui-button id="previous—page" class="hideonmobile" href="javascript:void(0);"
onclick="prevPage()">上一章</mdui-button>
onclick="prevPage()" style="margin-right:8px;">上一章</mdui-button>
<a style="display:none;" href="{{ path_to_root }}{{link}}" id="helper_prevpage" class="helper"></a>
{{/previous}}
{{#next}}
@ -78,6 +79,7 @@
onclick="nextPage()">下一章</mdui-button>
<a style="display:none;" href="{{ path_to_root }}{{link}}" id="helper_nextpage" class="next—pagehelper"></a>
{{/next}}
</div>
{{#if git_repository_url}}
<mdui-button-icon icon="web" href="{{git_repository_url}}"></mdui-button-icon>
{{/if}}

View File

@ -39,13 +39,13 @@ function changePage(url) {
document.body.scrollTop = 0;
var old_tag = document.getElementsByClassName("mdui-prose")[0];
var old_topbar_tag = document.getElementsByClassName("topbar")[0];
var old_topbar_tag = document.getElementsByClassName("navbtn")[0];
var old_navcard_tag = document.getElementsByClassName("navcard")[0];
var virtualtag = document.createElement('div');
virtualtag.insertAdjacentHTML('beforeend', xhr.responseText);
var title = virtualtag.getElementsByTagName("title")[0].innerText;
old_tag.innerHTML = virtualtag.getElementsByClassName("mdui-prose")[0].innerHTML;
old_topbar_tag.innerHTML = virtualtag.getElementsByClassName("topbar")[0].innerHTML;
old_topbar_tag.innerHTML = virtualtag.getElementsByClassName("navbtn")[0].innerHTML;
old_navcard_tag.innerHTML = virtualtag.getElementsByClassName("navcard")[0].innerHTML;
var elements = document.querySelectorAll('[active]');