Console error in WordPress - Uncaught ReferenceError: rive is not defined
Hi there,
I'm having an issue with animations not loading for me at all around 80% of the time, 20% of the time they load great. The error I am having seems to suggest the rive.js file I'm loading from here - https://cdn.jsdelivr.net/npm/@rive-app/canvas@latest/rive.js isn't loading all of the time. So my question is: Is this the correct place to pull this rive.js file from? Has anyone else experienced this? How can I overcome the sporadic loading of this file to make the animations load correctly?
Thanks in advance
Hi
Hi
It's very weird because there is no error on the network, rive.min.js looks like it's loading in ok, but in the console I get the error I have above "Uncaught ReferenceError: rive is not defined" and in the sources panel it says the issue with the section "new rive.Rive({})
Could there be a race condition between loading the library and executing the code?
Could you try to wrap the code in "document.addEventListener("DOMContentLoaded", function(){}" to see if it fixes it?
Yeah that's fixed the loading issues