Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Enabling and disabling drag and drop #107

Open
capitanjacksparrow opened this issue Mar 14, 2017 · 1 comment
Open

Enabling and disabling drag and drop #107

capitanjacksparrow opened this issue Mar 14, 2017 · 1 comment

Comments

@capitanjacksparrow
Copy link

Is it possible to enable and disable drag and drop on the basis of mouse or touch events?
I tried by setting dragAndDrop property in this way, on a click event:

$('#grid').gridList({dragAndDrop: false});

However, the layout changes (it doesn't fit the vertical direction anymore) and the widgets behavior becomes unstable.

@bojan88
Copy link

bojan88 commented Jul 25, 2017

Try this:

function disableDrag() {
  $('.grid-item').draggable('disable');
  $('.grid-item').bind('dragstart', gridItemDisableHandler);
}

function enableDrag() {
  $('.grid-item').draggable('enable');
  $('.grid-item').unbind('dragstart', gridItemDisableHandler);
}

Note that you have to add grid-item class to the items.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants