we bendthetrend
we bendthetrend

Reputation: 59

Drag and drop programmatically - jquery

Here is my fiddle : https://jsfiddle.net/a9rkz2pg/

The blocks in the widgets group can be dragged using the mouse drag event, as a clone and dropped into Group 1 or Group 2,3,4.. (appears on click of plus button)

But, is there a way this can be done programmatically, either by knowing the id/class of the draggable or it’s text content?

new Sortable($('#widgets-1')[0], {
  group: {
    name: 'letters',
    put: false,
    pull: 'clone',
  },
  setData: function(dataTransfer, element) {
    dataTransfer.setData('text', element.textContent);
  },
  sort: false
});

Any help would be much appreciated. Thank you!

Upvotes: 0

Views: 466

Answers (0)

Related Questions