Hi,
I'm using barba.js which means the the first time I load a page on my site, the book works fine. But when I click through to any other page with a book, the book doesn't load.
The flipbook javascript files are still included in the second page, but it seems that the flipbook just needs to be triggered.
Is there a JS function I can use that will trigger the flipbook to load, assuming the "_3d-flip-book" element/container is already in place?
Thanks
Hi, reexecute client.min.js
Ok, I will try that, thanks
I've done what you suggested. I've also added alert(); to the client script to make sure it's definitely re-executing, and it is.
However, the variable FB3D_CLIENT_LOCALE (inside the #3d-flip-book-client-js-extra element) doesn't change after client.min.js has been re executed. Any idea?
Thanks
FB3D_CLIENT_LOCALE is script localization for client.min.js it is defined after parsing all shortcodes on the back end.
Ok, thanks.
Currently the book will only work on the first instance. If I navigate to a second book page (ie. with a different shortcode), it will show "no items found", even though the book will work on this page if I refresh and start from here. I just assumed FB3D_CLIENT_LOCALE was the cause of this as it appears to keep the information of the previous book, even after a redirect.
Could you write a link to your page?
removed Then Go to Book B Check console log for comments Thanks
Hi, can you please let me know when you have had a look, so I can remove the link from the previous comment thanks
?
FB3D_CLIENT_LOCALE is script localization for client.min.js, it is defined after parsing all shortcodes on the back end.
if you look for FB3D_CLIENT_LOCALE in page A elements - you will find FB3D_CLIENT_LOCALE definition for page B only - so your Ajax does not fetch the scripts localization
wp_localize_script('3d-flip-book-client', 'FB3D_CLIENT_LOCALE',[...]);
.Enter in console FB3D_CLIENT_LOCALE, see jsData - there is only 38 post. After ajax FB3D_CLIENT_LOCALE is not redefined.
Also you can somewhere in common for all Ajax pages insert
this includes data in FB3D_CLIENT_LOCALE
Thanks, I'll give that a try
I couldn't get it to work so I ended up loading them through a separate iframe. Eg. When I need to load any new book dynamically I just change my iframe src so it points to a new page that only has the headers, book shortcode and footer.
well, this also simple and should work)