vikikai Posted November 20 Posted November 20 Site URL: https://www.zenithhealthwellness-lv.com Is there a code to make the typing text animation looping?
Ziggy Posted November 20 Posted November 20 5 hours ago, vikikai said: Is there a code to make the typing text animation looping? What code are you using? Please like and upvote if my comments were helpful to you. Cheers! Zygmunt Spray Squarespace Website Designer Contact me: https://squarefortytwo.com Hire me on Upwork! 📈 SEO Space (Referral link) Ⓜ️ Will Myers' Plugins & Tutorials (Referral link) 🔌 Ghost Squarespace Plugins (Referral link) ⬛ SquareWebsites Plugins (Referral link) 🔲SQSP Themes (Referral link) ✨ Spark Plugin (Referral link) 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) ☕ Did I help? Buy me a coffee?
Squareko Posted November 20 Posted November 20 add this code to code injection > footer : <script> document.addEventListener("DOMContentLoaded", function () { const text = "Your Semi-Title Text Here"; const element = document.querySelector("#semi-title"); let index = 0; function typeWriter() { if (index < text.length) { element.innerHTML += text.charAt(index); index++; setTimeout(typeWriter, 100); // Adjust typing speed here } else { setTimeout(() => { element.innerHTML = ""; // Clear text index = 0; typeWriter(); // Restart typing }, 2000); // Pause before restarting } } typeWriter(); }); </script> here, text will be replaced by you what you want. add this code to custom css: #semi-title { font-size: 24px; /* Adjust size as needed */ font-weight: bold; color: #333; /* Customize color */ /* Add any additional styling here */ } add this code to code block: <span id="semi-title"></span>
vikikai Posted November 21 Author Posted November 21 For Code Block: Quote <div class="typeit">Type here</div> For Custom CSS Quote .typeit { overflow: hidden; font-size:25px; /* this can be any font size you want */ border-right: 2px solid #50bdb8; /* change this color in the keyframe too */ white-space: nowrap; margin: 0 auto; animation: typeit 3.5s steps(40) infinite, right-border .5s step-end infinite; } @keyframes typeit { from { width: 0 } to { width: 100% } } @keyframes right-border { from, to { border-color: transparent } I only gave that a shot but it worked.
Squareko Posted November 21 Posted November 21 add this code to code injection > footer : <script> document.addEventListener("DOMContentLoaded", function () { const text = "Your Semi-Title Text Here"; const element = document.querySelector("#semi-title"); let index = 0; function typeWriter() { if (index < text.length) { element.innerHTML += text.charAt(index); index++; setTimeout(typeWriter, 100); // Adjust typing speed here } else { setTimeout(() => { element.innerHTML = ""; // Clear text index = 0; typeWriter(); // Restart typing }, 2000); // Pause before restarting } } typeWriter(); }); </script>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment