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

138
Views
arrastrar y soltar reordenar imágenes en un div

Estoy creando una aplicación web donde los usuarios pueden agregar una imagen cargada desde sus dispositivos, quiero que puedan reordenar estas imágenes usando arrastrar y soltar para habilitar la reorganización. Intenté usar JQuery y javascript, pero parece que no puedo hacerlo bien. Gracias por adelantado.

 document.querySelector("#files").addEventListener("change", (e) => { if (window.File && window.FileReader && window.FileList && window.Blob) { const files = e.target.files; const output = document.querySelector("#result"); const div = document.createElement("ul"); for (let i = 0; i < files.length; i++) { if (!files[i].type.match("image")) continue; const picReader = new FileReader(); picReader.addEventListener("load", function (event) { const picFile = event.target; const div = document.createElement("div"); div.setAttribute("draggable", "true"); div.setAttribute("class", "image_div"); div.style.width = "60px"; div.style.height = "60px"; div.style.marginLeft = "10px"; div.style.flexShrink = "0"; div.style.overflowY = "hidden"; div.innerHTML = `<img class="thumbnail" src="${picFile.result}" title="${picFile.name}"/>`; output.appendChild(div); }) picReader.readAsDataURL(files[i]); } } else { alert("Your browser does not support File API") } })
 #result { display: flex; background-color: yellow; margin-top: -60px; margin-left: 60px; height: 65px; width:100%; overflow-x: auto; overflow-y: hidden; } .thumbnail { /*height: 60px; width: 60px; border-radius: 6px;*/ height: 60px; width: 60px; object-fit:cover; border-radius: 6px; }
 <div id="result"> </div>

resultado ahora

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