Not work p5.js in Elementor external window (iframe)

Hi all. Problem with iframe Elementor in Frontend editor, library not find element, when i create canvas. Any idea? Thanks!

const canvasAudio = createCanvas(windowWidth, windowHeight);
canvasAudio.parent(‘audio_visualizers’);

This problem similar with isotope and now problem in p5.js

The parent() function in p5.js is used to attach the canvas to a specific HTML element. If you’re specifying parent('audio_visualizers'), make sure that an element with the ID audio_visualizers exists in the DOM. In the context of an iframe, it’s important to ensure that this element exists within the same iframe as your p5.js script.

Could you provide a reduced test case or at least a link to the page that shows the issue?

1 Like