bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
21.89k stars 1.97k forks source link

How to disable/ enable dragular with varialbe dynamically? #525

Closed willowTank closed 6 years ago

willowTank commented 6 years ago

I want to disable/enable dragular with variable dynamically. Please help me.

darlanmendonca commented 6 years ago

the method moves can be used to that, e.g.

const allowDrag = false; // <= change this variable to true to allow drag
const options = {
      containers: [document.querySelector('.list')],
      moves(element) {
        return allowDrag
      },
}