barbajs / barba

Create badass, fluid and smooth transitions between your website’s pages
https://barba.js.org/
MIT License
11.61k stars 476 forks source link

How to check for barbacontainer #722

Closed mattiabf closed 11 months ago

mattiabf commented 11 months ago

hello,

I am trying to run Barba on a Wordpress website.

Because of the fact that certain Wordpress plugins have issues with the header not re-loading, I would like to make some pages with barba, and some other pages without it.

So: a few templates will have the barbacontainer, and others won't.

When I click on a link, I would like to check if the barbacontainer is present on the next page before doing the transition. If we have the barbacontainer, then we can proceed with the transition, if not, we can prevent barba from running and force reload.

My rough idea was to run some code in the beforeEnter stage, when both the current and next container are present, and then check if data.next.container (which should be a string) returns "null".

Unfortunately I had no luck with this.

Could you please help?

xavierfoucrier commented 11 months ago

Hi @mattiabf,

This issue is more related to how your code is running than Barba v2 issue...

For this kind of question/help, 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.