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

144
Vistas
Chnaging the data attribute inside the div doesn't change image for 360 spin view

I am using js-cloudimage-360-view.min.js to get a 360 view of images. I am getting the images perfectly, but I am unable to change the images by clicking a button.

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class = 'test' style="width: 400px; margin: 100px auto;">
        <div
        class="cloudimage-360"
        data-folder="images/"
        data-filename="{index}.jpg"
        data-amount="22"
        >
    </div>
    <div>
        <button>Click</button>
    </div>
        
    <script src="main.js"></script>
    <script src="js-cloudimage-360-view.min.js"></script>

</body>
</html>

main.js

const img_box = document.querySelector('.cloudimage-360')
const btn = document.querySelector('button')


btn.addEventListener('click',()=>{
    img_box.dataset.folder = 'temp_images/'
    img_box.dataset.filename = '{index}.png'
    console.log(img_box.dataset)
})

console.log(img_box.dataset)

Here is the folder structure

  • images
  • temp_images
  • index.html
  • js-cloudimage-360-view.min.js
  • main.js

Now in order for the 360 view to work, I have to specify the data-folder, data-filename and data-amount correctly inside the div tag and it is working fine. But I want to change the data-folder = 'temp_images/' and data-filename = '{index}.png' when the button is clicked to show a different set of images. I can see all the changes have been done correctly in the console, but the image remains the same. How can I get the images from different folders after clicking the button?

Here is the Github link

https://github.com/scaleflex/js-cloudimage-360-view

Here is a youtube tutorial

https://www.youtube.com/watch?v=uEl4Q6dG7BA&t=111s

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I suspect you'll need to destroy the component, change the attributes, and then init it again.

window.CI360.destroy();
img_box.dataset.folder = 'temp_images/';
img_box.dataset.filename = '{index}.png';
window.CI360.init();

If it still doesn't work, then it would probably be best to ask the author(s) directly.

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