新增说说网页版,点击图片放大的功能

This commit is contained in:
SwimmingLiu 2024-09-16 00:28:57 +08:00
parent 147037a9ef
commit 1cd373be8c

View File

@ -61,6 +61,7 @@ def show_author_info():
def get_html_template():
# HTML模板
# HTML模板
html_template = """
<!DOCTYPE html>
@ -116,6 +117,7 @@ def get_html_template():
max-width: 33vw;
max-height: 33vh;
border-radius: 10px;
cursor: pointer;
}}
.comments {{
margin-top: 5px; /* 调整这里的值来减少间距 */
@ -147,7 +149,14 @@ def get_html_template():
<body>
{posts}
<script>
// 为所有图片添加点击事件
document.querySelectorAll(".image img").forEach(img => {{
img.addEventListener("click", function() {{
window.open(this.src, '_blank'); // 打开图片链接并在新标签页中展示
}});
}});
</script>
</body>
</html>
"""