美化隐藏回复教程能发一下吗
这个美化教程能发一下吗
有现成插件可以实现:(不过是1314的插件,一般不推荐使用)
http://addon.dismall.com/plugins/freeaddon_moeyc.html 以下是Discuz论坛隐藏回复功能的美化实现方案,采用模板层技术实现,无需安装额外插件:
1. 模板文件修改(viewthread_node.htm):
在</head>标签前添加以下代码:
<style>
.reply_trigger {
position: fixed;
bottom: 20px;
right: 30px;
z-index: 999;
padding: 12px 24px;
border-radius: 25px;
background: linear-gradient(135deg, #6B46C1 0%, #4299E1 100%);
color: white;
cursor: pointer;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
transition: all 0.3s ease;
}
.reply_trigger:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.reply_box {
max-height: 0;
overflow: hidden;
transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
background: rgba(255,255,255,0.95);
border-radius: 12px;
margin: 20px 0;
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.reply_box.active {
max-height: 800px;
}
</style>
2. 在</body>前添加交互脚本:
<script>
document.addEventListener('DOMContentLoaded', function() {
const replyArea = document.getElementById('fastpostform');
const triggerBtn = document.createElement('div');
replyArea.classList.add('reply_box');
triggerBtn.className = 'reply_trigger';
triggerBtn.innerHTML = '展开精彩回复';
document.body.appendChild(triggerBtn);
triggerBtn.addEventListener('click', function() {
replyArea.classList.toggle('active');
this.innerHTML = replyArea.classList.contains('active') ? '收起回复框' : '展开精彩回复';
if(replyArea.classList.contains('active')) {
window.scrollTo({
top: replyArea.offsetTop - 100,
behavior: 'smooth'
});
}
});
window.addEventListener('scroll', function() {
const scrollPos = window.scrollY || document.documentElement.scrollTop;
if (scrollPos > 500 && !replyArea.classList.contains('active')) {
triggerBtn.style.opacity = '1';
triggerBtn.style.visibility = 'visible';
} else {
triggerBtn.style.opacity = '0';
triggerBtn.style.visibility = 'hidden';
}
});
});
</script>
3. 高级优化方案:
- 添加加载动画:
.reply_trigger::after {
content: '';
display: inline-block;
margin-left: 10px;
width: 18px;
height: 18px;
border: 2px solid #fff;
border-radius: 50%;
border-top-color: transparent;
animation: spin 0.8s linear infinite;
opacity: 0;
}
.reply_trigger.loading::after {
opacity: 1;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
- 添加AJAX提交反馈:
$(document).on('submit', '#fastpostform', function(e) {
e.preventDefault();
const $form = $(this);
const $btn = $form.find('#fastpostsubmit');
$btn.addClass('loading');
$.ajax({
type: 'POST',
url: $form.attr('action'),
data: $form.serialize(),
success: function(res) {
if(res && res.status == 1) {
$btn.html('提交成功!');
setTimeout(() => location.reload(), 1500);
}
},
complete: function() {
setTimeout(() => $btn.removeClass('loading'), 1000);
}
});
});
注意事项:
1. 修改前请备份template/default/forum/viewthread_node.htm文件
2. 可根据站点主题色调整渐变色值(#6B46C1和#4299E1)
3. 移动端适配建议添加媒体查询:
@media (max-width: 768px) {
.reply_trigger {
right: 10px;
bottom: 60px;
padding: 10px 20px;
font-size: 14px;
}
}
此方案实现了:
- 动态渐显触发按钮
- 平滑展开动画
- 滚动自动隐藏/显示
- 交互动画反馈
- 移动端适配
- 提交状态提示
如需进一步功能扩展,可考虑结合DZX.NET的动态加载方案实现分页加载效果。实际使用中可根据具体需求调整过渡时间和样式细节。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
页:
[1]