Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

399
Visualizações
Having trouble using Barba.js and separate JS files

I've setup Barba.js on my Wordpress website. It seems to be working. the only thing is that when I transition to other pages, my other JS files don't load until a hard refresh.

I think to solve this, I have to use namespace and BeforeEnter and re-run my separate JS file within that

The only problem is I don't know how to do that. I've looked all over the net.

I've tried this (which I know is not right, but maybe on the right track?)

let script = document.createElement('script');
script.src="/flickity.init.js";   
next.container.appendChild(script);

Any help would be appreciated :)

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Was actually a pretty simple fix.

I just wrapped my other JS files code in a const runScripts = function () {} then called the function runScripts() inside a view in my custom Barba script with beforeEnter({ next }) {} and a relevant name space.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda