1 Reply Latest reply on May 8, 2014 1:00 PM by hemanthR

    Drag and Drop with snapping


      I'm trying to create a drag and drop map where the country snaps into place on top of it's target. I have loaded all necessary libraries and the dragging works fine. I just need it to snap into it's place. Here's my code...





                sym.$('Peru_target').droppable({drop: function() {sym.getSymbol("Peru2").play();}});


      And here's the example...






        • 1. Re: Drag and Drop with snapping
          hemanthR Adobe Employee

          Since all your assets positions are absolute,you can set the desired top and left values of div your are dragging in the drop callback function.

          Something like

          sym.$('Peru_target').droppable({drop: function() {

          var symbol = sym.getSymbol("Peru2");

          var ele = symbol.getSymbolElement();

          $(ele).css({top:<your value>;left:<your valye>});




          Hopefully this helps

          1 person found this helpful