加入留言板博客按钮

This commit is contained in:
DelLevin-Home
2026-05-18 00:02:14 +08:00
parent 66ece06271
commit fa4c784b96
10 changed files with 1735 additions and 9 deletions

View File

@@ -8,7 +8,10 @@
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
width: 300px;
display: none;
transition: opacity 0.2s ease;
opacity: 0;
transform: translateY(10px) scale(0.95);
transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 悬浮框内容 */

826
static/css/guestbook.css Normal file
View File

@@ -0,0 +1,826 @@
/* 留言板按钮容器 */
.guestbook-btn-container {
position: fixed;
top: 20px;
right: 80px;
z-index: 999;
}
/* 博客文章按钮容器 */
.blog-posts-btn-container {
position: fixed;
top: 95px;
right: 80px;
z-index: 999;
}
.guestbook-btn {
background: #fff;
border: 1px solid #e8e8e8;
border-radius: 50%;
width: 60px;
height: 60px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.blog-posts-btn {
background: #fff;
border: 1px solid #e8e8e8;
border-radius: 50%;
width: 60px;
height: 60px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.btn-label {
font-size: 12px;
color: #666;
line-height: 1;
}
.guestbook-btn:hover,
.blog-posts-btn:hover {
border-color: #d0d0d0;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
transform: translateY(-2px) scale(1.05);
}
.guestbook-btn svg,
.blog-posts-btn svg {
width: 28px;
height: 28px;
}
.guestbook-btn svg path,
.blog-posts-btn svg path {
transition: stroke 0.3s ease;
}
.guestbook-btn:hover svg path,
.blog-posts-btn:hover svg path {
stroke: #333;
}
/* Hover 浮动预览面板 */
.guestbook-preview,
.blog-posts-preview {
visibility: hidden;
position: absolute;
top: 0;
right: calc(100% + 15px); /* 在按钮左侧显示 */
width: 380px;
max-height: 400px;
background: linear-gradient(to bottom, #fafafa, #fff);
border-radius: 16px;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
z-index: 1000;
opacity: 0;
transform: translateX(20px) scale(0.95);
transform-origin: center right;
transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
visibility 0.5s;
overflow: hidden;
border: 1px solid rgba(240, 240, 240, 0.8);
pointer-events: none;
backdrop-filter: blur(20px);
}
/* 当鼠标悬停在容器上时显示预览面板 */
.guestbook-btn-container:hover .guestbook-preview,
.blog-posts-btn-container:hover .blog-posts-preview {
visibility: visible;
opacity: 1;
transform: translateX(0) scale(1);
pointer-events: auto;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.1);
}
.preview-header {
padding: 14px 18px;
border-bottom: 1px solid #f0f0f0;
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
}
.preview-header h3 {
margin: 0;
font-size: 15px;
color: #333;
font-weight: 500;
letter-spacing: 0.5px;
}
.preview-body {
padding: 0;
overflow-y: auto;
max-height: calc(400px - 50px);
}
.preview-item {
padding: 12px 18px;
border-bottom: 1px solid #f5f5f5;
transition: background 0.2s ease;
}
.preview-item:last-child {
border-bottom: none;
}
.preview-item:hover {
background: #fafafa;
}
.preview-nickname {
font-weight: 500;
color: #333;
font-size: 13px;
margin-bottom: 4px;
}
.preview-content {
color: #666;
font-size: 12px;
line-height: 1.5;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.preview-time {
color: #999;
font-size: 11px;
margin-top: 4px;
}
.preview-complete {
text-align: center;
padding: 15px;
color: #bbb;
font-size: 12px;
font-style: italic;
}
/* 完整留言板弹窗(点击后显示) */
.guestbook-full-modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10000;
justify-content: center;
align-items: center;
animation: fadeIn 0.3s ease;
}
.guestbook-full-modal.active {
display: flex;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.full-modal-content {
background: #fff;
border-radius: 12px;
width: 92%;
max-width: 850px;
max-height: 92vh;
overflow: hidden;
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
animation: slideUp 0.3s ease;
}
@keyframes slideUp {
from {
transform: translateY(30px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
/* Toast 弹窗 */
.toast-container {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 100000;
pointer-events: none;
}
.toast {
background: rgba(51, 51, 51, 0.95);
color: #fff;
padding: 12px 24px;
border-radius: 8px;
font-size: 13px;
margin-bottom: 10px;
opacity: 0;
transform: translateY(-20px);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10px);
}
.toast.show {
opacity: 1;
transform: translateY(0);
}
.toast.success {
background: rgba(76, 175, 80, 0.95);
}
.toast.error {
background: rgba(244, 67, 54, 0.95);
}
/* 留言板模态框 */
.guestbook-modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10000;
animation: fadeIn 0.3s ease;
}
.guestbook-modal.active {
display: flex;
justify-content: center;
align-items: center;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.guestbook-content {
background: #fff;
border-radius: 8px;
width: 90%;
max-width: 800px;
max-height: 85vh;
overflow: hidden;
/* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); */
animation: slideUp 0.3s ease;
}
@keyframes slideUp {
from {
transform: translateY(30px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.guestbook-header {
padding: 16px 20px;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
}
.guestbook-header h2 {
margin: 0;
font-size: 16px;
color: #333;
font-weight: 500;
letter-spacing: 0.5px;
}
.guestbook-close {
background: none;
border: none;
font-size: 24px;
color: #999;
cursor: pointer;
line-height: 1;
padding: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.3s ease;
}
.guestbook-close:hover {
color: #333;
}
.guestbook-body {
padding: 0;
overflow-y: auto;
max-height: calc(92vh - 60px);
}
/* 留言表单 - 固定在顶部 */
.guestbook-form {
margin-bottom: 15px;
padding: 15px 20px;
border-bottom: 1px solid #eee;
position: sticky;
top: 0;
background: #fff;
z-index: 10;
}
/* 留言列表 */
.guestbook-list {
display: flex;
flex-direction: column;
gap: 8px;
padding: 15px 20px;
}
.guestbook-item {
padding: 10px 12px;
border: 1px solid #f0f0f0;
border-radius: 6px;
background: #fff;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
margin-bottom: 0;
}
.guestbook-item:hover {
border-color: #e0e0e0;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transform: translateY(-1px);
}
.guestbook-item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
padding-bottom: 8px;
border-bottom: 1px solid #f5f5f5;
}
/* 头像样式 */
.guestbook-item-header > div:first-child img {
width: 32px;
height: 32px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #f5f5f5;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
.guestbook-item:hover .guestbook-item-header > div:first-child img {
border-color: #e0e0e0;
transform: scale(1.05);
}
.guestbook-reply .guestbook-item-header > div:first-child img {
width: 28px;
height: 28px;
}
.guestbook-nickname {
font-weight: 500;
color: #333;
font-size: 13px;
}
.guestbook-nickname a {
color: #333;
text-decoration: none;
border-bottom: 1px dotted #999;
transition: all 0.3s ease;
}
.guestbook-nickname a:hover {
color: #000;
border-bottom-color: #333;
}
.guestbook-meta {
font-size: 11px;
color: #999;
}
.guestbook-content {
color: #555;
line-height: 1.6;
font-size: 13px;
word-wrap: break-word;
padding: 4px 0;
}
/* 美化留言内容中的 HTML 元素 */
.guestbook-content p {
margin: 0 0 6px 0;
line-height: 1.6;
}
.guestbook-content p:last-child {
margin-bottom: 0;
}
.guestbook-content a {
color: #333;
text-decoration: none;
border-bottom: 1px dotted #999;
transition: all 0.3s ease;
}
.guestbook-content a:hover {
color: #000;
border-bottom-color: #333;
}
.guestbook-content img {
max-width: 100%;
height: auto;
border-radius: 4px;
margin: 6px 0;
}
.guestbook-content blockquote {
margin: 6px 0;
padding: 8px 12px;
background: #f9f9f9;
border-left: 3px solid #ddd;
color: #666;
font-style: italic;
}
.guestbook-content code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 13px;
color: #e74c3c;
}
.guestbook-content pre {
background: #f5f5f5;
padding: 8px;
border-radius: 4px;
overflow-x: auto;
margin: 6px 0;
}
.guestbook-content pre code {
background: none;
padding: 0;
color: #333;
}
/* 留言底部信息(浏览器、系统、地址) */
.guestbook-footer {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid #f5f5f5;
}
.guestbook-info-item {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: #999;
transition: color 0.3s ease;
}
.guestbook-info-item svg {
opacity: 0.6;
}
.guestbook-info-item:hover {
color: #666;
}
.guestbook-reply {
margin-top: 15px;
padding: 12px 15px;
background: #f9f9f9;
border-radius: 4px;
border-left: 3px solid #ddd;
}
.guestbook-reply .guestbook-item {
background: transparent;
border: none;
padding: 10px 0;
margin-bottom: 10px;
}
.guestbook-reply .guestbook-item:last-child {
margin-bottom: 0;
}
.guestbook-reply .guestbook-item:hover {
box-shadow: none;
}
.guestbook-reply .guestbook-nickname {
font-size: 13px;
color: #666;
}
.guestbook-reply .guestbook-content {
font-size: 13px;
color: #777;
line-height: 1.6;
}
/* 留言表单 - 固定在顶部 */
.guestbook-form {
margin-bottom: 12px;
padding: 12px 20px;
border-bottom: 1px solid #eee;
position: sticky;
top: 0;
background: #fff;
z-index: 10;
}
.form-row {
display: flex;
gap: 8px;
margin-bottom: 8px;
}
.form-group {
flex: 1;
}
.form-group-full {
margin-bottom: 8px;
}
.form-group label {
display: block;
margin-bottom: 3px;
color: #666;
font-size: 11px;
}
.form-group input,
.form-group textarea,
.form-group-full textarea {
width: 100%;
padding: 6px 10px;
border: 1px solid #e8e8e8;
border-radius: 4px;
font-size: 12px;
color: #333;
background: #fafafa;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
font-family: inherit;
box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group-full textarea:focus {
outline: none;
border-color: #999;
background: #fff;
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}
.form-group textarea,
.form-group-full textarea {
resize: vertical;
min-height: 50px;
line-height: 1.5;
font-family: inherit;
}
.form-group textarea::placeholder,
.form-group-full textarea::placeholder {
color: #bbb;
}
.form-submit {
text-align: right;
margin-top: 10px;
}
.submit-btn {
background: #333;
color: #fff;
border: none;
padding: 8px 20px;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.submit-btn:hover {
background: #000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.submit-btn:active {
transform: translateY(0);
}
.submit-btn:disabled {
background: #ccc;
box-shadow: none;
cursor: not-allowed;
}
/* 加载状态 */
.guestbook-loading {
text-align: center;
padding: 30px 25px;
color: #999;
font-size: 14px;
}
.guestbook-empty {
text-align: center;
padding: 40px 25px;
color: #999;
font-size: 14px;
}
/* 加载更多按钮 */
.load-more-btn {
display: block;
margin: 20px auto 20px auto;
background: #fff;
border: 1px solid #e8e8e8;
color: #666;
padding: 10px 30px;
border-radius: 20px;
cursor: pointer;
font-size: 13px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.load-more-btn:hover {
border-color: #999;
color: #333;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transform: translateY(-1px);
}
.load-more-btn:disabled {
color: #ccc;
border-color: #eee;
cursor: not-allowed;
}
/* 加载完成提示 */
.load-complete {
text-align: center;
padding: 20px 25px;
color: #bbb;
font-size: 13px;
font-style: italic;
}
/* 博客文章列表样式 */
.blog-post-item {
padding: 12px;
border-bottom: 1px solid #f5f5f5;
transition: background-color 0.3s ease;
}
.blog-post-item:last-child {
border-bottom: none;
}
.blog-post-item:hover {
background-color: #fafafa;
}
.blog-post-title {
font-size: 14px;
color: #333;
margin-bottom: 6px;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.blog-post-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
color: #999;
}
.blog-post-category {
background: #f0f0f0;
padding: 2px 6px;
border-radius: 3px;
font-size: 10px;
}
/* 响应式设计 */
@media (max-width: 768px) {
.guestbook-btn-container {
right: 15px;
top: 15px;
}
.blog-posts-btn-container {
right: 15px;
top: 90px;
}
/* 移动端预览面板调整位置,避免超出屏幕 */
.guestbook-preview,
.blog-posts-preview {
right: auto;
left: calc(100% + 10px);
transform-origin: center left;
transform: translateX(-20px) scale(0.95);
}
.guestbook-btn-container:hover .guestbook-preview,
.blog-posts-btn-container:hover .blog-posts-preview {
transform: translateX(0) scale(1);
}
.guestbook-content {
width: 95%;
max-height: 90vh;
}
.guestbook-body {
padding: 0;
}
.guestbook-form {
padding: 15px 20px;
}
.guestbook-list {
padding: 20px;
}
.guestbook-loading,
.guestbook-empty,
.load-complete {
padding-left: 20px;
padding-right: 20px;
}
/* 移动端表单改为垂直排列 */
.form-row {
flex-direction: column;
gap: 15px;
}
}

View File

@@ -23,6 +23,7 @@ body {
}
.letter-container {
/* max-width: 65%; */
max-width: 850px;
margin: 0 auto;
background: white;
@@ -81,10 +82,26 @@ body {
/* 内容区域 */
.tab-content {
display: none;
opacity: 0;
transform: translateY(10px);
transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-content.active {
display: block;
animation: tabFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes tabFadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 信纸纹理效果 */
@@ -181,6 +198,15 @@ body {
border: 1px solid #eee;
border-radius: 4px;
background-color: #fafafa;
cursor: pointer;
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.tool-item:hover,
.game-item:hover {
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.tool-name,
@@ -248,6 +274,7 @@ body {
/* 底部版权信息 - 在信纸外部 */
#footer-wrap {
max-width: 850px;
/* max-width: 65%; */
margin: 0 auto 20px auto;
text-align: center;
padding: 20px;