Trigger javascript on element event (such as onclick)

Hello, I am new to webflow and i am considering to rebuild my project here if all the requirements are present.

I am doing a game. I have a javascript engine that renders in a canvas, and i am using external server and database. I want to create a webflow static website to serve as UI/interface of the game.

So i want to fully integrate my code into the static webflow page.

So far, i have been liking webflow, but i need a certain feature:

  • Easily way to create a javascript response, when a webflow element is clicked, hovered etc… (directly from the webflow element tab).

Maybe this is already supported? or there is a easy way i could make this work…
I appreciate any help.

1 Like

Hi @Andre_Marques

I can’t help on the custom code side, but here’s an intro to the various interactions you can set up using Webflow: Interactions & animations course | Webflow University

Also paging @matthewpmunger who made a game in Webflow :wink:

https://webflow.com/website/mario-maze-game

Hey guys

That maze game was done entirely with built-in interactions and no custom code. Fun little sample project. If you need any help or advice with interactions, please tag me and I’ll see what I can do.

For now, maybe this tutorial by @mistercreate can give you some direction or inspiration. It also pertains to a custom canvas based on user input.

2 Likes

Since i wrote this question here on the forum, I have been building a nodeJS framework that works with mongoDB and that integrated my code with webflow. (working on it for about 5 months, 24/7)

On each element (webflow element tab) i create an attribute: data-exec-onclick = “code to be executed”. or data-entangle = “this.innerHTML = this.retrieve(data, “fields.fields”)”

It’s possible and it’s so easy now.

details:

my webflow site built with the framework: www.spreadbig.com

1 Like