Reload scripts on AJAX page reload
-
We are trying to add page transitions using the?https://swup.js.org/?library.
This all works great and we’ve got a nice transition that covers the page and then slides away again when the new content is loaded. However, because the pages now load via AJAX, the scripts that makes the Elementor entrance animations and background videos work doesn’t get initiated. I can see that the video URL just isn’t applied to the <video> element.
The first time I go to the page it works fine, if I then navigate away and come back it no longer works as I think the scripts have already been initiated and they don’t realise the page has been loaded again.
Swup has a plugin that allows us to force reload scripts when a new page is shown and this does make the video and entrance animations work but it also causes issues with other scripts.
What I think might work is to dequeue the Elementor scripts that make the entrance animations and background videos work. Then enqueue them again but set these to be reloaded. However, I need to know the name of all scripts Elementor needs to make this content work…
If you have a better idea then be sure to let me know.
Staging site: [ redundant link removed ]
The page I need help with: [log in to see the link]
- The topic ‘Reload scripts on AJAX page reload’ is closed to new replies.