Barba: How to add and remove scripts in certain pages

Created on 8 Aug 2019  路  5Comments  路  Source: barbajs/barba

Hello,
I have a problem with adding and removing scripts on some pages. I suspect this has to do with data-barba-namespace but these scripts are outside of data-barba = "container".
I have no idea how to add them if I am on the right page or delete them if I am off this page.

Ps. it's not about functions, but about files e.g.

`


All 5 comments

Hi @ProdesignerAgency,

For now, as specified in the documentation:

_Be aware, everything inside of this wrapper and outside of the container will not be updated by Barba_

Meaning it would not be updated as well, because the page is not fully reloaded when using barba.

So, if you want to add scripts on some pages, you will need to use barba View to target the right page and manipulate the DOM to create the <script> tags and load your scripts.

Note that in a near future, barba will be able to update the <head>, depending on the view you are entering/leaving/etc.., with the @barba/head module. :+1:

OK thank You :)

So, if you want to add scripts on some pages, you will need to use barba View to target the right page and manipulate the DOM to create the

Related issues

bobbyballard picture bobbyballard  路  3Comments

kram08980 picture kram08980  路  3Comments

shanewmurphy picture shanewmurphy  路  3Comments

hugobqd picture hugobqd  路  3Comments

Mellis84 picture Mellis84  路  3Comments