Gustavo Luigi 2024-01-11 16:58:55 -03:00
parent 4443c41b20
commit 1409c76753
1 changed files with 15 additions and 0 deletions

View File

@ -225,6 +225,7 @@
});
</script>

<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>

<script>
// Get the elements
@ -265,8 +266,22 @@
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
nameField.addEventListener("focus", () => {
setTimeout(() => {
let typed = new Typed('#name', {
strings: ['Max Mustermann'],
typeSpeed: 50,
backSpeed: 25,
showCursor: false,
startDelay: 500,
loop: false
});
}, 1000);
});

if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) nameField.focus()
else setTimeout(() => nameField.focus(), 2000);

observer.unobserve(targetElement);
}
});