barbajs/barba

Loading JS files on EVERY page

bnmz41998 opened this issue · 2 comments

Hello,

Just began work on a website that uses Barba.js and I'm having the well known issue of the JS files not loading/working after the firstpage, UNLESS I hard reload that page.

Example I go to homepage JS elements work fine, click products, none of the JS elements work on the products page unless I reload?

I've been having a look around and found that hooks is a great way to do this, would this work or is it too simple of a solution:

barba.hooks.enter(() => {
<script src="/assets/js/jquery-3.4.1.min.js"></script> ,
<script src="/assets/js/core.js"></script>
});

I know I've probably got it wrong but I've had a go, any help would be greatly appreciated.

NOTE: This is for someone else that's used a ready made template, I'm just trying to fix it.

Hi @bnmz41998,

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.

@bnmz41998 Did you resolve this? If so, can you share how?