barba icon indicating copy to clipboard operation
barba copied to clipboard

I can't get Barba CSS to work with Locomotive-Scroll

Open bossybe opened this issue 4 years ago • 4 comments
trafficstars

Hello all,

I would like to make Barba CSS work with Locomotive-scroll. I do a simple opacity transition and a smooth scroll. Both work perfectly separately but together it doesn't work anymore.

My code :

const scroll = new LocomotiveScroll({
    el: document.querySelector('[data-scroll-container]'),
    smooth: true
});

barba.hooks.after(() => {
  scroll.init();
});

barba.use(barbaCss);
barba.use(barbaPrefetch);
barba.init()

While examining the dom, I noticed that at the change of page my <div data-barba = "container"> go out of my <main data-scroll-container>

Why does it do that? This problem happens when I use the @barba/css plugin, without it everything works.

Thank you in advance for your help

bossybe avatar Sep 09 '21 11:09 bossybe

Hi @bossybe,

I will need some time to check and see what's going on. Thanks for your patience! :wink:

xavierfoucrier avatar Sep 09 '21 13:09 xavierfoucrier

Hi guys! Any updates here? I have the same behavior.

dmitriyakkerman avatar Oct 17 '21 14:10 dmitriyakkerman

Hi @dmitriyakkerman,

Sorry I am busy right now, working to release a project at end of month. I will have time for a complete check next month, stay tuned! :wink:

xavierfoucrier avatar Oct 18 '21 07:10 xavierfoucrier

Hello,

I confirm an issue with barba CSS, it move the whold data-barba="container" div to the very end of the page (just before the end of the body) When I remove the barbaCSS script and use JS transition instead, it works as expected.

PubliAlex avatar Jun 16 '22 13:06 PubliAlex

Hello 👋 Sorry for the long delay.

It's not related to Locomotive Scroll, but more similar to the issue #479. I already fixed it last week, but it looks in some situation it can be improved, especially when dealing with a more complex DOM structure.

xavierfoucrier avatar May 08 '23 00:05 xavierfoucrier