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

288
Views
¿Cómo deshabilitar la animación fallida de arrastrar y soltar?

En javascript, cuando un elemento se arrastra fuera del área de colocación no válida.

¿Cómo deshabilitar la animación de caída fallida? (la sombra del elemento arrastrado vuelve a la posición del elemento arrastrado)

ver captura de pantalla: ingrese la descripción de la imagen aquí

código de mozila ejemplo:

 const source = document.getElementById("source"); const target = document.getElementById("target"); const event_log = document.getElementById("event-log"); function dragstart_handler(ev) { event_log.textContent += "dragStart\n"; // Change the source element's background color to signify drag has started ev.currentTarget.style.border = "dashed"; ev.dataTransfer.setData("text", ev.target.id); } function dragover_handler(ev) { event_log.textContent += "dragOver\n"; // Change the target element's border to signify a drag over event // has occurred ev.currentTarget.style.background = "lightblue"; ev.preventDefault(); } function drop_handler(ev) { event_log.textContent += "Drop\n"; ev.preventDefault(); const data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragenter_handler(ev) { event_log.textContent += "dragEnter\n"; // Change the source element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { event_log.textContent += "dragLeave\n"; // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(ev) { event_log.textContent += "dragEnd\n"; // Change the target element's background color to visually indicate // the drag ended. target.style.background = "pink"; } // Set handlers for the source's drag - start/enter/leave/end events source.ondragstart = dragstart_handler; source.ondragenter = dragenter_handler; source.ondragleave = dragleave_handler; source.ondragend = dragend_handler; // Set handlers for the target's drop and dragover events target.ondrop = drop_handler; target.ondragover = dragover_handler; // Set click event listener on button to reload the example const button = document.getElementById("reload"); button.addEventListener("click", () => { document.location.reload(); }); full example: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/ondragend
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!