I'm trying to get barba.js and locomotive scroll to work correctly when switching pages. But when going from one page to another, the locomotive stops working. The error is as follows: "Uncaught TypeError: Cannot read property 'match' of undefined"
This is my code. I can't remove locomotive completely when I leave a page
const scroll = new LocomotiveScroll({
el: document.querySelector(".js-scroll"),
smooth: true
});
barba.hooks.beforeLeave(data => {
scroll.destroy();
});
barba.hooks.enter(data => {
scroll.init();
});
barba.init();
@vidi45,
Please update your issue to explain it with more consistency and better code syntax.
Thanks.
Hi, @xavierfoucrier
It's already corrected. Excuse the awkwardness
@vidi45 thanks :smiley: !
Some peoples reported the same issue, I will test and give a feedback as soon as possible. :wink:
Hi @vidi45,
I just add a dedicated LocomotiveScroll section inside the advanced third party scripts documentation on the Barba website.
This section may evolve in time based on LocomotiveScroll updates...
Feel free to close the issue.
Happy reading! :wink:
Thank you very much! | 聽
Hi @simonerama and @cl-alessandro-molari,
Please use the Slack workspace in order to ask the whole community for support. Join using the invite link here: https://barba.js.org/docs/getstarted/useful-links/#Developer.
@cl-alessandro-molari your repository code looks fine for me, but I was unable to run it on localhost due to pug/parcel build failure...
I am locking the conversation.