Do you have a solution to keep my ScrollMagic functions working with Ajax page transitions ? I think I have to make something refreshing my JavaScript functions after a page transition, but I don't know how to do.
the difficulty is that AJAX transitions load the target page content container and omits the header and footer (since it's not a full page load), so any js scripts enqueued there are omitted.
my only ideea try enqueing the scrollmagic scripts in /include/scripts-config.php
or for any extra initialization use the model from our grenada wpbakery child (I attach it here for your convenience) in childscript.js, the ajaxSuccess event handler.
I already have de ajaxSuccess function in chilscript.js.
I tried enqueing me chilscript.js file in /include/scripts-config.php, but it don't work. I'm really not sure if I made it well or not. Can you check it in the file attached here ?
Yes the jQuery plugin is already used by the theme by default.
I know the scroll magic is coded in /js/scripts.js, but I made my own scrollMagic scenes in childscript.js (see the attachment).
My problem is still the same : my custom ScrollMagic code in childscript.js is not working with Ajax Load activated.
It works when I put my code from childscript.js in /js/scripts.js, but not when my code is only in childscipt.js, because childscript.js is not enqueued the same way than /js/scripts.js for Ajax Loading.
So how can I enqueue childscript.js to work with Ajax page transitions like it work with /js/scripts.js ?
Have you tried to navigate from a page to another page with the "Load Page in Ajax" enabled in the theme options ? Because I disabled it before to avoid the bug, but I want to be able to enable Ajax Load with my pages loading correctly.
In your video it seems like the page transition you made isn't with the ""Load Page in Ajax" option activated.
Try to switch between pages "About" and "Missions" with Ajax Load and you'll see I think.
Hello !
I customized the theme using ScrollMagic functions (like you can see on this page : http://with-barry.fr/what-we-do/ or this one : http://with-barry.fr/who-we-are/), but I have to disable Ajax transitions to make them work.
Do you have a solution to keep my ScrollMagic functions working with Ajax page transitions ? I think I have to make something refreshing my JavaScript functions after a page transition, but I don't know how to do.
Thank you !
Hello Quentin,
the difficulty is that AJAX transitions load the target page content container and omits the header and footer (since it's not a full page load), so any js scripts enqueued there are omitted.
my only ideea try enqueing the scrollmagic scripts in /include/scripts-config.php
or for any extra initialization use the model from our grenada wpbakery child (I attach it here for your convenience) in childscript.js, the ajaxSuccess event handler.
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy
Hello,
Thank you for your answer !
I already have de ajaxSuccess function in chilscript.js.
I tried enqueing me chilscript.js file in /include/scripts-config.php, but it don't work. I'm really not sure if I made it well or not. Can you check it in the file attached here ?
I added
And
Thank you for your help
I mean scrollmagic script files and then in childscript.js you put the code for any initialization you need in each page.
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy
I don't understand because ScrollMagic scripts file is already enqueued in scripts-config.php by default :
And I don't understand when you say "you put the code for any initialization you need in each page."
I didn't said it, but my customs scrollmagic functions are in childscript.js, I don't know if it's useful to say that.
Sorry but I'm a beginner in jQuery and JS, can you help me ?
Thank you
Hello Quentin,
ok, sorry there was a bit of confusion. first I thought you are talking about the Scroll Magic plugin
https://codecanyon.net/item/scroll-magic-wordpress-scrolling-animation-builder-plugin/19418234?gclid=EAIaIQobChMIlZ7ZgcLT5QIVGs13Ch2emAebEAAYASAAEgJI4vD_BwE
which is the WordPress version of the scroll magic jquery library we are using and is indeed already enqueued in the theme.
https://scrollmagic.io/
The scroll magic is coded in /js/scripts.js, look for ScrollMagic.Controller() or ScrollMagic.Scene()
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy
Hello.
Yes the jQuery plugin is already used by the theme by default.
I know the scroll magic is coded in /js/scripts.js, but I made my own scrollMagic scenes in childscript.js (see the attachment).
My problem is still the same : my custom ScrollMagic code in childscript.js is not working with Ajax Load activated.
It works when I put my code from childscript.js in /js/scripts.js, but not when my code is only in childscipt.js, because childscript.js is not enqueued the same way than /js/scripts.js for Ajax Loading.
So how can I enqueue childscript.js to work with Ajax page transitions like it work with /js/scripts.js ?
This is my question.
Sorry for the confusion.
Can you help me again please ?
Thank you.
Sure what's the site url.
While we are at it, send us wp admin access in a private comment
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy
I don't understand because it don't work for me.
Have you tried to navigate from a page to another page with the "Load Page in Ajax" enabled in the theme options ? Because I disabled it before to avoid the bug, but I want to be able to enable Ajax Load with my pages loading correctly.
In your video it seems like the page transition you made isn't with the ""Load Page in Ajax" option activated.
Try to switch between pages "About" and "Missions" with Ajax Load and you'll see I think.
Hi Quentin,
I modified the childscripts.js code so that will excute the custom scenes in ajax and normal mode (see the link to the short clip)
https://d.pr/free/v/gQva8C
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy
Now it works !
Thank you !