Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Los enlaces de anclaje saltan a la posición precisa después de cargar las imágenes

Similar a esta publicación , mi caso no usa React Router o jQuery. Es solo una página y verticalmente larga. En cuanto al título, los enlaces de anclaje no saltan a la posición precisa ya que las imágenes no se cargan y no pueden calcular la ubicación precisa. Encontré una solución e intenté lo siguiente, pero no funcionó. ¿Cómo puedo resolverlo?

ACTUALIZACIÓN: como en el comentario, la configuración de los tamaños de imagen tampoco funcionó.

 export const useScrollToLocation = () => { const scrolledRef = useRef(false) const { hash } = useLocation() const hashRef = useRef(hash) useEffect(() => { if (hash) { // We want to reset if the hash has changed if (hashRef.current !== hash) { hashRef.current = hash scrolledRef.current = false } // only attempt to scroll if we haven't yet (this could have just reset above if hash changed) if (!scrolledRef.current) { const id = hash.replace('#', '') const element = document.getElementById(id) if (element) { element.scrollIntoView({ behavior: 'smooth' }) scrolledRef.current = true } } } })

}

 function App() { return ( <> <useScrollToLocation> <Navigation /> <Hero /> <Concept /> <Shop /> <Footer /> </useScrollToLocation> </> ) } export default App
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!