Website Building » Wix » How Do I Add Custom Interactions With JavaScript Corvid by Wix?

How Do I Add Custom Interactions With JavaScript Corvid by Wix?

Last updated on October 1, 2022 @ 10:00 am

Adding custom interactions to your Wix site with JavaScript Corvid is easy and fun! With Corvid, you can add custom code to your site to create dynamic interactions and experiences for your visitors. Here’s how to get started:

First, create a new file in the Corvid editor. You can give it any name you want, but we’ll call it “interactions.js” for this example. Next, add the following code to your new file:

GREAT NEWS:

Exciting update! We've collaborated with Wix to offer WBI users with a free plan for all website creation needs - Explore the details here.

function myFunction() {
alert(‘Hello world!’); }

This is a simple function that will display an alert box with the message “Hello world!” when it is called. You can add as much or as little code as you like to this file, but for now we’ll keep it simple.

PRO TIP: Please be aware that adding custom interactions with JavaScript Corvid by Wix can be a complicated process. If you are not comfortable with coding or working with complex technical tasks, we recommend that you seek professional help.

Now that you have created your function, you need to call it somewhere on your site. The easiest way to do this is to add a button somewhere on your page, and have the button call the function when it is clicked. To do this, first add a button to your page using the Wix Editor:

1.Click the Add button in the left sidebar.
2.Click the More button.
3.Click the Button option.
4.Click where you want to add the button on your page.
5.Enter some text for the button label, such as “Click me!”

Now that you have added a button to your page, you need to edit its properties so that it calls your function when it is clicked. To do this:

>

  • 1.

>

>

>

>

>

  1. Hover over the button on your page so that the edit toolbar appears.
  2. Click the ” button in the toolbar.

    <button onclick="myFunction()">Click me!</button ></code >
    or click here.

    The code should look like this:

    <button onclick="myFunction()">Click me!</button >} </code >If it does not look like this or if you are unsure if you did it correctly, please ask for help in our forum.After adding the code, click Save and then Preview Site in the top bar to test out your new button! When you click on the button, you should see an alert box appear with the message "Hello world!".

    Congratulations, you've just added your first custom interaction using JavaScript Corvid!There are many more things that you can do with Corvid - far too many to list here! If you're looking for inspiration, check out our blog posts about Corvid, or head over to our forum (where you can also ask questions and get help from other developers). We can't wait to see what you build!

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.