I have tried barba.js and locomotive-scroll to work (I also tried scrollmagic) and I am not getting it working fine. If I put locomotive-scroll on the about page and reload the browser, it works, but if I go from there to the home page and go back to about page, it gives me an error and stops working. With other scripts there are no problems, that's why I consider that there must be some incompatibility. I have tried many ways and they all give me an error. The last one is:
$(function () {
barba.init({
sync: true,
cacheIgnore: false,
transitions: [
{
async leave(data) {
const done = this.async();
pageTransition();
await delay(1000);
done();
},
async enter(data) {
contentAnimation();
},
async once(data) {
contentAnimation();
},
},
],
views: [{
namespace: 'about-section',
beforeEnter({ next }) {
let script = document.createElement('script');
script.src = 'http://127.0.0.1:5000/locomotive-scroll.js';
next.container.appendChild(script);
}
}]
});
});