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

123
Vistas
Page pointing to previous id in same browser same tab

I have written a js scripts to point an id on document.ready function but when I used same other id in the url then it pointed to the previous id, My first point id is abc.com/#firstid and second is id abc.com/#secondid. while I am using it second id in the same browser same tab it pointed to first is i.e pointing to the section having id #firstid

 jQuery( document ).ready(function(e) {
           
          if (window.location.href.indexOf("/#") > -1) {
            var str = window.location.href;
            var spilt = str.split("/#");
            var url_id = spilt[1];
            console.log(url_id);
            jQuery('html, body').animate({ scrollTop: jQuery("."+url_id).offset().top-100 }, 100); 
            
           }  
           
        });


<div class="#firstid">
1
</div>
<div class="#secondid">
2    
</div>

after browse the url in browser abc.com/#firstid it points on 1 and while browse abc.com/#secondid it pointed on 2 but after then goes to 1 as page complete load

about 4 years ago · Juan Pablo Isaza
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