Importing code from CodePen to Tilda - how?

  • 0
    Salute, comrades!

    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>


    And in the end - nothing. I ask knowledgeable people to help. Thank you in advance.
    JavaScript Zachary McDonald, Oct 13, 2019

  • 1 Answers
  • 0
    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
    var selector= '.tn-elem__2381583471602451581454.tn-atom';
    - check your selector, into which you need to insert the script work, if necessary - adjust it to fit your needs.



    Copy the styles and script, before that do not forget to connect the libraries. And no appendages.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!