mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 19:02:17 +08:00
html页面输入页码可以回车跳转,跳转后自动滚动到页面顶部。统一了缩进
This commit is contained in:
parent
115ace3ae5
commit
abab101821
@ -518,7 +518,6 @@ html_head = '''
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chat Records</title>
|
||||
<style>
|
||||
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
@ -779,9 +778,7 @@ input {
|
||||
<div class="item item-center">
|
||||
<span>昨天 13:15</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div></div>
|
||||
<div id="modal" class="modal" onclick="hideModal()">
|
||||
@ -793,7 +790,7 @@ input {
|
||||
<button onclick="nextPage()">下一页</button>
|
||||
</div>
|
||||
<div class="jump-row">
|
||||
<input type="number" id="gotoPageInput" placeholder="跳转到第几页">
|
||||
<input type="number" id="gotoPageInput" onkeydown="checkEnter(event)" placeholder="跳转到第几页">
|
||||
<button onclick="gotoPage()">跳转</button>
|
||||
</div>
|
||||
<div id="paginationInfo"></div>
|
||||
@ -846,6 +843,11 @@ html_end = '''
|
||||
}
|
||||
}
|
||||
|
||||
function checkEnter(event) {
|
||||
if (event.keyCode === 13) {
|
||||
gotoPage();
|
||||
}
|
||||
}
|
||||
|
||||
const itemsPerPage = 100; // 每页显示的元素个数
|
||||
let currentPage = 1; // 当前页
|
||||
@ -898,6 +900,7 @@ html_end = '''
|
||||
}
|
||||
chatContainer.appendChild(messageElement);
|
||||
}
|
||||
document.querySelector("#chat-container").scrollTop = 0;
|
||||
updatePaginationInfo();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user