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

241
Views
¿Cómo tener un botón que agregue elementos arrastrables de Draggabilly?

Estoy trabajando en un sitio web que utiliza el paquete Draggabilly de desandro. Me pregunto cómo puedo implementar un botón que agregará un nuevo elemento que se puede arrastrar. Mi método actual (que se muestra a continuación) crea lo que se puede arrastrar pero no permite que se arrastre.

HTML

 <!DOCTYPE html> <html lang="en"> <head> <title>Testing creating a button to add a draggable</title> <meta charset="UTF-8"> <meta name="viewpoint" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="styles.css"> </head> <body> <button id="addDragBtn">Add draggable</button> <script src="scripts.js"></script> </body> </html>

CSS

 body { font-family: sans-serif; } .draggable { width: 140px; height: 140px; background: #F90; border-radius: 10px; cursor: move; } .draggable.is-pointer-down { background: #09F; } .draggable.is-dragging { opacity: 0.7; }

JavaScript

 let $draggable = $('.draggable').draggabilly(); function addDrag() { var div = document.createElement('div'); div.className = "draggable"; document.body.appendChild(div); }; let btn = document.getElementById("addDragBtn"); addDragBtn.addEventListener( 'click', event => { addDrag(); } );
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!