From eaa3bedf593c560b3a11a2e5859bc70cb05b8acb Mon Sep 17 00:00:00 2001 From: Gustavo Luigi <=> Date: Thu, 11 Jan 2024 17:32:16 -0300 Subject: [PATCH] . --- content/contents/leistungen.blade.php | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/content/contents/leistungen.blade.php b/content/contents/leistungen.blade.php index 685f0cd..0de273c 100644 --- a/content/contents/leistungen.blade.php +++ b/content/contents/leistungen.blade.php @@ -263,27 +263,28 @@ const nameField = document.getElementById('name'); nameField.placeholder = ""; const targetElement = document.querySelector('#lumino-form-sent'); - + 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, - attr: 'placeholder' - }); - }, 1000); - }); + let typedOptions = { + strings: ['Max Mustermann'], + typeSpeed: 50, + backSpeed: 25, + showCursor: false, + startDelay: 500, + loop: false, + attr: 'placeholder' + }; - if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) nameField.focus() - else setTimeout(() => nameField.focus(), 2000); + if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { + nameField.focus(); + setTimeout(() => new Typed('#name', typedOptions), 500); + } + else setTimeout(() => { + nameField.focus(); + setTimeout(() => new Typed('#name', typedOptions), 500); + }, 2000); observer.unobserve(targetElement); }