Back-to-Top Button auf allen Seiten hinzugefügt mit Smooth-Scroll und Fade-in/out Effekt
This commit is contained in:
@@ -228,27 +228,49 @@ footer a:hover {
|
||||
}
|
||||
}
|
||||
|
||||
/* Scroll to Top Button (optional) */
|
||||
.scroll-to-top {
|
||||
/* Back to Top Button */
|
||||
.back-to-top {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
right: 2rem;
|
||||
display: none;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 3rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
font-size: 2rem;
|
||||
z-index: 1000;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.scroll-to-top:hover {
|
||||
.back-to-top.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.back-to-top:hover {
|
||||
background-color: var(--secondary-color);
|
||||
color: white;
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
/* Mobile: kleinerer Button */
|
||||
@media (max-width: 768px) {
|
||||
.back-to-top {
|
||||
bottom: 1rem;
|
||||
right: 1rem;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loading Animation (optional) */
|
||||
|
||||
@@ -259,6 +259,11 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Back to Top Button -->
|
||||
<a href="#" id="back-to-top" class="back-to-top" aria-label="Nach oben scrollen">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</a>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Custom JS -->
|
||||
|
||||
@@ -218,6 +218,11 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Back to Top Button -->
|
||||
<a href="#" id="back-to-top" class="back-to-top" aria-label="Nach oben scrollen">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</a>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Custom JS -->
|
||||
|
||||
@@ -257,6 +257,11 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Back to Top Button -->
|
||||
<a href="#" id="back-to-top" class="back-to-top" aria-label="Nach oben scrollen">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</a>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Custom JS -->
|
||||
|
||||
25
js/main.js
25
js/main.js
@@ -194,3 +194,28 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Back to Top Button
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const backToTopButton = document.getElementById('back-to-top');
|
||||
|
||||
if (backToTopButton) {
|
||||
// Button bei Scroll anzeigen/verstecken
|
||||
window.addEventListener('scroll', () => {
|
||||
if (window.pageYOffset > 300) {
|
||||
backToTopButton.classList.add('show');
|
||||
} else {
|
||||
backToTopButton.classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Button Klick-Event
|
||||
backToTopButton.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -271,6 +271,11 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Back to Top Button -->
|
||||
<a href="#" id="back-to-top" class="back-to-top" aria-label="Nach oben scrollen">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</a>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Custom JS -->
|
||||
|
||||
Reference in New Issue
Block a user