Habs jetzt so gelöst:
in die session im head:
Code:
<?php if (!isset($_SESSION['visited'])) { echo ""; $_SESSION['visited'] = true; } else { echo "<script> function scrollToSmoothly(pos, time) { var currentPos = window.pageYOffset; var start = null; if(time == null) time = 500; pos = +pos, time = +time; window.requestAnimationFrame(function step(currentTime) { start = !start ? currentTime : start; var progress = currentTime - start; if (currentPos < pos) { window.scrollTo(0, ((pos - currentPos) * progress / time) + currentPos); } else { window.scrollTo(0, currentPos - ((currentPos - pos) * progress / time)); } if (progress < time) { window.requestAnimationFrame(step); } else { window.scrollTo(0, pos); } }); } </script>"; } ?>
Code:
onLoad="scrollToSmoothly(document.querySelector('#underslider').offsetTop, 500)"
Trotzdem Danke für Deine Antwort.
Einen Kommentar schreiben: