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

99
Views
Unable to set a container div with a tree element as a drag image in drag operation

I have a tree structure in UI in angularjs, and I am trying to drag a subtree from one parent node to another parent node. During this operation I need drag image to be of the entire subtree being dragged, however since the drag is actually on the node, it just shows the image of the node and not entire subtree. To solve this I tried to set the drag image as the container div which contains the entire subtree. However with this, it just sets the last element as drag image.

$scope.dragTreeNode = function(event,dragNode) {  
    let element = event.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
                
    var dummyElement = document.createElement('DIV');
    dummyElement.id = 'draggedElement';
    let cloned = element.cloneNode(true);
    dummyElement.appendChild(cloned);
    document.body.appendChild(dummyElement);
    cloned.classList.add('ghosted');
    console.log(cloned);
    event.dataTransfer.setDragImage(dummyElement, 0, 0);

}

starting drag for this node

Drag image set to last element of tree

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!