Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropEvent.reject() #613

Merged
merged 5 commits into from
Mar 23, 2018
Merged

DropEvent.reject() #613

merged 5 commits into from
Mar 23, 2018

Conversation

taye
Copy link
Owner

@taye taye commented Mar 20, 2018

<div class="container" data-color="red"></div>
<div class="container" data-color="green"></div>

<div class="draggable" data-color="red">Item 1</div>
<div class="draggable" data-color="blue">Item 2</div>
<div class="draggable" data-color="green">Item 3</div>

<script>
interact('.container')
  .dropzone({
    accept: '.draggable',
  })
  .on('dragenter', event => {
      const dropzoneElement = event.target;
      const draggableElement = event.relatedTarget;

      if (draggableElement.dataset.color !== dropzoneElement.dataset.color) {
        event.reject();
      }
    })
  .on('drop', event => {
    console.log('dropped');
  });
</script>
  • tests
  • docs

Close #552

@taye taye force-pushed the feat-drop-reject branch from 18c7f65 to 6e551ab Compare March 22, 2018 23:35
@taye taye merged commit 6e551ab into master Mar 23, 2018
@taye taye deleted the feat-drop-reject branch June 1, 2018 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant