ich habe in einem Template Holgers Scroll-Script:
Code: Select all
// smooth scroll to anchor
$('a[href^="#"]').on('click', function(e){
var href = $(this).attr('href');
$('html, body').animate({
scrollTop: $(href).offset().top - 120}, 600);
e.preventDefault();
});
/*** Ergänzung ***/
$('a[href^="#"].start').on('click', function(e){
var href = $(this).attr('href');
$('html, body').animate({
scrollTop: $(href).offset().top - 0}, 600);
e.preventDefault();
});
Das funktioniert zwar (scrollt erst bis zum Offset und dann das restliche Stück weiter), ist aber mit Sicherheit nur eine laienhafte Lösung.
Kann mir mal jemand auf den Hinterkopf klopfen?