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

136
Views
Reubicar elemento según el tamaño de la pantalla

Necesito colocar un elemento en una página según el tamaño del navegador. No puedo ocultar y mostrar este elemento porque solo puede estar una vez en el dom. Parece bastante sencillo, pero estoy atascado. Parece estar funcionando parcialmente. ¿Necesito hacer algún tipo de separación/conexión? Lo siento, ha pasado un tiempo desde que jugué con JS simple.

 srPos(); window.onresize = srPos(); function srPos() { var ww = window.innerWidth, sr = document.getElementById("gcs-box"), pp = document.getElementById("primary-panel"), sp = document.getElementById("secondary-panel"); if (ww > 991) { sp.prepend(sr); } else { pp.prepend(sr); } }

¿Qué me estoy perdiendo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está asignando el valor devuelto por srPos en lugar de la función en sí a la propiedad onresize .

Retire los corchetes:

 srPos(); window.onresize = srPos; function srPos() { var ww = window.innerWidth, sr = document.getElementById("gcs-box"), pp = document.getElementById("primary-panel"), sp = document.getElementById("secondary-panel"); if (ww > 991) { sp.prepend(sr); } else { pp.prepend(sr); } }
about 4 years ago · Juan Pablo Isaza Report
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!