Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda