Proless
Proless

Reputation: 217

Drag and drop function matching images

i made a dropspot for drag and drop function in a div which has image + dropspot but unfortunately my function doesnt work :( am i wrong ?

http://jsfiddle.net/6tsfh/

$(function() {
    $( ".right img" ).draggable
    ({

    revert: "invalid",
    helper: 'clone'

    });
    $( "#dropspot0" ).droppable({

      tolerance: 'fit',

      drop: function( event, ui ) {
         $(ui.draggable).clone().appendTo($("#dropspot0"));
      }
    });
  });

Upvotes: 0

Views: 432

Answers (1)

crazycloud
crazycloud

Reputation: 179

Check this jsFiddle

I think JqueryUI library was not included in jsfiddle.

$(function() {
  $( ".right img" ).draggable
  ({

  revert: "invalid",
  helper: 'clone'

  });
  $( "#dropspot0" ).droppable({

    tolerance: 'intersect',

     drop: function( event, ui ) {
     $(ui.draggable).clone().appendTo($("#dropspot0"));
  }
  });
});

Upvotes: 2

Related Questions