Integrating Typed.js by Matt Boldt into Webflow allows you to create dynamic text animations on your site. Here's how to do it:
1. Add a Custom Code Component
- In your Webflow Designer, navigate to the page where you wish to add the typed text.
- Drag and drop an Embed element (found in the "Add" panel) onto your page where you want the animation to appear.
2. Include Typed.js Library
- In the Embed element, insert the following script tag to include the Typed.js library from a CDN:
```html
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>
```
- This ensures that the Typed.js library will be loaded on your page.
3. Insert HTML Markup
- Still within the Embed element, add a span or a div with an ID or class that will be used for the typed text, like:
```html
<span id="typed-output"></span>
```
4. Configure Typed.js Options
- In the page settings, go to the Before </body> tag section in the Custom Code area.
- Insert a script to initialize the Typed.js instance. For example:
```html
<script>
document.addEventListener('DOMContentLoaded', function() {
new Typed('#typed-output', {
strings: ["Welcome to Webflow!", "Enhance your website with Typed.js"],
typeSpeed: 50,
backSpeed: 25,
loop: true
});
});
</script>
```
- Adjust typeSpeed, backSpeed, and loop as desired to fit your animation needs.
5. Publish and Test
- Publish your Webflow project to an accessible URL.
- View the published page to ensure the Typed.js animation functions as expected.
Summary
Typed.js can be integrated into Webflow by adding a custom code component with the library link, setting up HTML to display typed content, and using a script to configure animation settings. Adjust the speed settings and test to ensure proper functionality on the published page.