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

262
Vistas
How to update z-index values in two related lists 'A,B'(B is sortable items)

The two list are A, and B. The list B is sortable (drag-drop), each item in list 'B' is related with each item in list 'A' by index ! we set first this css propety to list 'B' items

#sortable2 li:nth-child(1) {
  z-index: 10!important;
  background-color: rgb(149, 168, 228);

}

#sortable2 li:nth-child(2) {
  z-index: 9!important;
  background-color: rgb(69, 223, 31);

}

#sortable2 li:nth-child(3) {
  z-index: 8!important;
  background-color: rgb(230, 47, 123);

}  ```

when the page is loaded, it dynamically give z-index of each item in List 'B' to each item in List 'A'; like this:

List B: #sortable2 li List A:#textSegments .jmSeg

for(var i=0;i<=$('#sortable2 li').length; i++){
    
        console.log($('#sortable2 li').eq(i).css('z-index'));
        $('#textSegments .jmSeg').eq(i).css('z-index',$('#sortable2 li').eq(i).css('z-index'));
    }

my question is after resort List 'B' items the z-index values in list 'B' change depending on the position of the item(layer). The "top item" of list 'B' set the highest z-index value and the last item gets the lowest z-index value , but z-index of List 'A' no changes. i tried this code below code to update list A z-index but also no changes

 $('#sortable2').sortable({ ........
.....................................
 update: function (event, ui) {
        
        for(var i=0;i<=$('#sortable2 li').length; i++){
    
                    console.log($('#sortable2 li:nth-child('+i+')').css('z-index'));
                    $('#textSegments .jmSeg').eq(i).css('z-index',$('#sortable2 li:nth-child('+i+')').css('z-index'));
                }


  [1]: https://i.stack.imgur.com/4hXad.jpg
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