Drag.Move.Collide 0.4
The Drag.Move.Collide class makes it easy to detect when two or more elements collide when dragging another element.
Details
- Author
- jnbdz
- Current version
- 0.4
- GitHub
- jnbdz/Drag.Move.Collide
- Downloads
- 2023
- Category
- Utilities
- Tags
- Report
- GitHub Issues
Releases
Dependencies
-
_self_/_current_:
- core/1.4: '*'
- Element.collide/0.5
- more:1.4.0.1/Drag/more: 1.4.0.1
- more:1.4.0.1/Drag.Move/more: 1.4.0.1
How to use
Similar to Drag.Move, Drag.Move.Collide needs all of the same informations.
new Drag.Move.Collide(document.id('drag'), {
container: $$('#collision>div')[0],
droppables: $$('#collision .drop'),
onCollide: function(element, droppable){
droppable.setStyle('background', '#E79D35');
},
onLeaveCollision: function(element, droppable){
droppable.setStyle('background', '#6B7B95');
},
onDrop: function(element, droppable){
if (droppable) droppable.setStyle('background', '#C17878');
}
});
Discuss
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus