Go_up
Hinweis: Tags sind nur angedeutet.
Vor /body
a href="#" id="go-up">/a
script
$( document ).ready(function() {
const $scrollBtn = $('#go-up');
// Sanftes Hochscrollen beim Klick
$scrollBtn.on('click', function(e) {
e.preventDefault();
$('html, body').animate({ scrollTop: 0 }, 600);
});
})
/script
in Verbindung mit scroll-Script:
style
#go-up {position: fixed; right:20px; bottom:20px; display: grid; place-items: center; opacity: 0; width: 30px; height: 30px; background: #444; border-radius:50%; border: 2px solid #666; transition: 1s all;}
#go-up:hover { bottom: 25px;}
#go-up img { width: 16px; height: auto; opacity: 0.5;}
body.scrolled #go-up {opacity: 1; }
@media (max-width: 600px) {
#go-up {right: 10px;}
}
/style
Neuere Themen:
Was aktuell so auffällt






