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

179
Vistas
How to replace div Element unperceived

I'm struggling with a problem. So I have fetched all the pictures from a json file. It loads and works great. The only problem is that when I click on the HTML element, that supposed to load the div element with the new pictures, but it is always visible when the pictures are removed and reloaded with the new ones. The content below the pictures jumps up for a millisecond, till the new elements are loaded. I try to make similar like this here 360 Ansicht, if you scroll down you will see the "360 Ansicht".

I think the last three code line should be somehow faster to be. Thanks

let loadPictures = async function ( objectIndex, carColorIndex, carIndex, indexOfActiveCarPicture = 0 ) {
    const carsThreeSixty = await fetch( '/360view.json' );
    const carsThreeSixtyRes = await carsThreeSixty.json();
    let pure = Object.entries( carsThreeSixtyRes );

    const html = document.createElement( 'div' );
    html.classList.add( 'rim-pictures' );
    html.classList.add( 'active' );

    for ( let j = 0; j < pure[objectIndex][1][carColorIndex].imagesForRotating[carIndex].length; j++ ) {
        let newImg = new Image();
        newImg.src = pure[objectIndex][1][carColorIndex].imagesForRotating[carIndex][j];

        html.appendChild( newImg );
    }
    document.querySelector( '.three-sixty-angle-container .color-pictures.active' ).innerHTML = '';
    document.querySelector( '.three-sixty-angle-container .color-pictures.active' ).appendChild( html );
    $( '.three-sixty-angle-container .rim-pictures.active img' ).eq( indexOfActiveCarPicture ).addClass( 'active' );
};

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