修复懒加载菜单展开问题
Build and Publish / Run (push) Successful in 5m42s Details

This commit is contained in:
cxykevin 2024-08-12 14:46:11 +08:00
parent 37cfe1b31e
commit ff8ffa0fd1
2 changed files with 5 additions and 3 deletions

View File

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

View File

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