How can Typed.js by Matt Boldt be integrated into Webflow?

TL;DR
  • Include Typed.js by adding its CDN link in Webflow's Project Settings under the Custom Code tab in the Head Code section.
  • Set up a text block in Designer with a unique ID or class name.
  • Add a custom script in the Body Code section to initialize and configure Typed.js using the text block's ID or class.

To integrate Typed.js by Matt Boldt into Webflow, you'll need to include the library in your project and set up the necessary elements and scripts to make it work. Here's how you can do it:

1. Include Typed.js in Project

  • Go to the Typed.js GitHub and copy the CDN link for the latest version of Typed.js.
  • Open Webflow, navigate to your Project Settings, and select the Custom Code tab.
  • Paste the Typed.js CDN link in the Head Code section to ensure it loads site-wide.

2. Set Up HTML Elements in Webflow

  • Navigate to your Designer, and add a Text Block element where you want the animated typing to appear.
  • Give the text block a Unique ID or Class Name for easy targeting. For instance, you could name it typed-output.

3. Add Custom Script to Implement

  • Go back to Project Settings and within the Custom Code tab under Body Code section, add a <script> tag to initialize Typed.js.
  • Inside the script, target the text block by the ID or class name you've set (e.g., '#typed-output').
  • Include your typed content within the strings array of the Typed.js configuration.

Example initialization:

<script>
  var options = {
    strings: ["Your first typed phrase", "Your next typed phrase"],
    typeSpeed: 50
  };

  var typed = new Typed("#typed-output", options);
</script>

4. Preview and Adjust

  • Publish your Webflow site to see the Typed.js in action.
  • Adjust the options like typeSpeedbackSpeed, or loop, according to your needs for a smoother animation.

Summary

To integrate Typed.js in Webflow, include the library via CDN in your Project Settings, set up a text block with a unique ID in your Designer, and add a custom script to initialize and configure the animation with your desired text. Adjust options in the script to customize the effect.

Rate this answer

Other Webflow Questions