Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the wrapper/container on the fly? #738

Open
louiswalch opened this issue Jun 13, 2024 · 3 comments
Open

Change the wrapper/container on the fly? #738

louiswalch opened this issue Jun 13, 2024 · 3 comments
Labels
question questioning about a functionality or usage

Comments

@louiswalch
Copy link

louiswalch commented Jun 13, 2024

Is it possible to dynamically change the wrapper and container element when a link is clicked, to load a sub part of the page?

Back in v1 of Barba this was possible in the linkClicked hook and then resetting it after load is complete. But I can't figure out how to do it in v2.

    Barba.Pjax.Dom.wrapperId        = name + '-wrapper';
    Barba.Pjax.Dom.containerClass   = name + '-container';

(If anyone stumbles on this, the code above is example of how it was done in v1, this isn't a v2 solution)

@xavierfoucrier xavierfoucrier added the question questioning about a functionality or usage label Jun 14, 2024
@xavierfoucrier
Copy link
Member

Hello @louiswalch 👋

From what I know, I don't think it's possible.

If you want to load a subpart of a dedicated page, you should adapt your wrapper area, and just put inside it the part of the page you only want to load. Documentation says you can put the wrapper on the body tag, but you can also put it if you want on a child div as well.

Could you please explain with more details what you are trying to achieve?
Thanks!

@xavierfoucrier
Copy link
Member

Bump @louiswalch 👋

@louiswalch
Copy link
Author

Apologies, to outline a scenario...

A website having a global navigation, where the body of the site has a fade transition. One area on that site (e.g. About) itself has a section navigation. When you're within that About section it would be nice to ONLY transition the actual page content and leave the section navigation visible.

This was possible in Barba V1 quite simply by changing the container/wrapper elements on the fly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question questioning about a functionality or usage
Projects
None yet
Development

No branches or pull requests

2 participants