Importing code from CodePen to Tilda - how?
There is an effect in CodePen: https://codepen.io/zadvorsky/pen/PNXbGo
How to add it to Tilda by applying it on a specific block or shape?
I understand that append needs to be done, but for some reason the code does not work for me, although the IDs are the same.
Created a Zero block, added shape there. I copied the code from the JS section in CodePen and pasted it into the HTML block in Tilda itself, surrounding it with the "script" tag, above, in the same block I created this:
<script> $(".tn-elem__2381583471602451581454 .tn-atom").append("<canvas id='three-container'></canvas>"); </script>
This is how you insert an empty canvas container. As a result, you will have it inserted, but without the content.
You need something like this: https://codepen.io/KorniloFF/pen/oNLXMBx
In the 4th line of the script there is
- check your selector, into which you need to insert the script work, if necessary - adjust it to fit your needs.
var selector= '.tn-elem__2381583471602451581454.tn-atom';
Copy the styles and script, before that do not forget to connect the libraries. And no appendages.Anonymous
To place the code, please use CodePen or similar tool. Thanks you!