question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Temporarily disable draggable

See original GitHub issue

Hey, congratulations on building this library, it’s really cool. Any way I could temporarily disable the draggable object? For example, I want to execute a promise, during which the draggable object should not be moved or interacted with (I’m going to animate it), and when the promise resolves, then I want to reenable it. LE : I found the enabled option, but how can I dynamically set it? Thanks.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tayecommented, Feb 7, 2015

Thanks!

You can pass true/false to the draggable method to enable or disable dragging.

interact(target)
  .draggable(false) // disable dragging
  .draggable(true)  // enable dragging

Or you could pass an object with it’s enabled property set to true/false

interact(target)
  .draggable({})    // no `enabled: false` prop, dragging is enabled
  .draggable({
    enabled: false  // explicitly disable dragging
  });
0reactions
phuwincommented, Oct 17, 2016

@kelvin4incubit I think you modified the code and your modification makes those not work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Disable Dragging an Image from an HTML Page?
One way to disable dragging an image from an HTML page is to set the ondragstart property of an image element to a...
Read more >
How to disable a jQuery-ui draggable of widget - GeeksforGeeks
In this article, we will see how to disable draggable widget using jQuery-ui. The jQuery UI consists of GUI widgets, visual effects, ...
Read more >
Disable Drag and Drop on HTML elements? - Stack Overflow
You can disable dragging simply by using draggable="false" attribute. https://developer.mozilla ...
Read more >
Windows 10: How to Disable Drag and Drop - Technipages
Steps to Disable Drag and Drop on Windows 10 · Click on the Windows Search bar and type regedit. · Double-click on the...
Read more >
Disable drag for a modal dialog | Syncfusion | jQuery - ejDialog
How to disable dragging in modal dialog ... In a modal dialog, dragging is enabled by default. It allows you drag the control...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found