How do I make these scripts and style working also on ajax loading? If I load from 0, without ajax I can see everything, but going back and forth seems that the stuffs enqueued via functions.php are not loading (like homepage scripts).
As you probably know Ajax page transitions loads the target page content container within the original page. Since the target page is not loaded normally the <head> and <body> elements will stay the same.
Since a lot of plugins are using javascript initialisation in the head (or the footer) of the page they don't get called in the target page.
The solution we found is to put all the extra inits in ajaxSuccess event handler as you can see in the child theme we provide in main archive (I attach it here for your convenience, childscript.js file)
Hi,
I enqueued custom CSS and JS.
How do I make these scripts and style working also on ajax loading?
If I load from 0, without ajax I can see everything, but going back and forth seems that the stuffs enqueued via functions.php are not loading (like homepage scripts).
This is my code:
thanks
Hello Denys,
As you probably know Ajax page transitions loads the target page content container within the original page. Since the target page is not loaded normally the <head> and <body> elements will stay the same.
Since a lot of plugins are using javascript initialisation in the head (or the footer) of the page they don't get called in the target page.
The solution we found is to put all the extra inits in ajaxSuccess event handler as you can see in the child theme we provide in main archive (I attach it here for your convenience, childscript.js file)
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy