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

234
Vistas
Async function in js or a chain of sticky position in css. Which or what else should I use to make a proper relation between two content containers?

I have a grid layout which has three fixed bars(red top bar, black right and bottom bar), flex banner in sticky grid (blue section, also shrinks) and two grid sections(white and lightgray areas in middle of page). When one of green square information buttons which are in white section, are clicked, a information content pops up in lightgray section.

I got a window.onscroll = function() {scrollFunctionTopPos()}; to handle that shrinking of banner(blue section) and position of division in lightgray section.

  1. If you scroll down first and popup the div by clicking buttons, then if you scroll up, banner and graysection are blended in the beginning, later, they get right positions.

    Should I use something like "async func" tricks/methods for that cases so "div" in graysector is positioned first, then banner unshrinks ?

  2. When I failed, as I mentioned earlier, I tried to use multiple sticky positions(i mean sticky blue banner and sticky light graysection) so i would not need to use a function to position "div" properly but it did not worked. Btw, The function is below.

  3. What do you think about making lightgray section fixed and use Element.getBoundingClientRect() to change position of that fixed section relatived to other sections or maybe HTML or body content?

JS fiddle:

https://jsfiddle.net/GrayCollar/odnhgkpx/26/

function scrollFunctionTopPos(){
  if (document.body.scrollTop > 40 || document.documentElement.scrollTop > 40) {
    scrollFunction_40_1000();
    document.getElementById("questioninfoDiv").style.top = "11vw";
    
  } else {
    scrollFunction_0_39();
    document.getElementById("questioninfoDiv").style.top = "25vw";
  }
}
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