一系列修改
This commit is contained in:
74
footer.php
74
footer.php
@@ -9,6 +9,78 @@
|
||||
</main>
|
||||
|
||||
<?php $this->footer(); ?>
|
||||
|
||||
<!-- 在 footer.php 的 </body> 标签前添加 -->
|
||||
<a id="back_to_top" href="#" class="back_to_top" style="display: none;"><span>↑</span></a>
|
||||
|
||||
<style>
|
||||
a.back_to_top {
|
||||
text-decoration: none;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
background: var(--accent-color);
|
||||
height: 43px;
|
||||
width: 43px;
|
||||
border-radius: 50%;
|
||||
line-height: 43px;
|
||||
font-size: 32px;
|
||||
text-align: center;
|
||||
transition: all 0.3s ease;
|
||||
display: none;
|
||||
z-index: 1000;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
a.back_to_top:hover {
|
||||
background: #6667ab;
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
a.back_to_top span {
|
||||
color: #fff;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
a.back_to_top {
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
a.back_to_top {
|
||||
bottom: 15px;
|
||||
right: 15px;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var backToTopBtn = document.getElementById('back_to_top');
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
backToTopBtn.style.display = window.pageYOffset > 30 ? 'block' : 'none';
|
||||
});
|
||||
|
||||
backToTopBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user