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

179
Visualizações
Barba.js : scrollRestoration and Wordpress issue

I'm trying to put somme animation between my home and my single page using barba.js (if something works better with wordpress let me know), Actually when I click to my post, the single page is scrolled as the other page was, it restore the scroll even When I put

barba.hooks.before(() => {
  if (history.scrollRestoration) {
    history.scrollRestoration = 'manual';
  }
});

barba.init({
  debug: true,
  transitions: [{
    name: 'projet-transition',
    from: {
      namespace: [
        'home'
      ]
    },
    to: {
      namespace: [
        'projet'
      ]
    },
    enter(data) {
        console.log(data)
    },
    leave(data) {
      console.log(data)
    },
  }]
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To reset the scroll position when navigating through links, you can do this:

barba.hooks.enter(() => {
    window.scrollTo(0, 0);
});

About scrollRestoration

History.scrollRestoration affects back and forward history navigation. If you need to restore scroll position when navigating backwards or forwards, check out this barba.js github issue. If not, I think it would be better if you don't set scrollRestoration to manual in the before hook, which runs on every page transition. You can place it outside barba hooks or in the beforeOnce hook.

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