Comments (3)
Thanks for clarification @p2kmgcl! I'll take a look on this!
from metal-plugins.
Hey @p2kmgcl, once targetOverClass
and draggingClass
receives a string to add classes, you could use like this example:
var dragDrop = new metal.DragDrop({
dragPlaceholder: metal.Drag.Placeholder.CLONE,
handles: '.handle',
sources: '.box',
targets: '.target',
targetOverClass: 'over over2',
draggingClass: 'dragx'
});
Note that when you are defining a targetOverClass
or draggingClass
the default targetOver
or dragging
class will not be added automatically. You can add manually like draggingClass: 'dragging dragx'
or targetOverClass: 'targetOver over over2'
, if you want add a existing default class, for example :)
from metal-plugins.
Hi @diegonvs, let me try to clarify this. While dragging some element, you have three elements:
- A target element where you are dragging over, which can be customized with
targetOverClass
. - A dragging element, which only exits while dragging, and which can be customized with
draggingClass
. - And a source element, which is the element where the drag started. This element cannot be customized, and this is the option I would like to have included with a
dragSourceClass
or so option.
A manual solution would be adding a customized class on dragStart
event and remove it on drop
, but I'd be nice to have it builtin:
function handleDragStart(data) {
data.source.classList.add('dragged');
}
function handleDrop(data) {
data.source.classList.remove('dragged');
}
from metal-plugins.
Related Issues (20)
- [metal-drag-drop] Add an option to refer element instead of mouse position when hovering a target and drop something
- [metal-drag-drop] Mouse position moves away from the element when the page is fully scrolled down HOT 1
- [metal-drag-drop] Draggable elements are not clickable HOT 3
- [metal-drag-drop] Drag.toElements_ method does not support every valid selector
- [metal-uri] [question] Why replacing + character with a blank space? HOT 2
- [metal-drag-drop] Allow defining a scroll container for autoScroll
- [metal-debounce] Stop including @babel/polyfill HOT 2
- [metal-drag-drop] scroll is looping when dragging an item
- [metal-drag-drop] issue on removeAllListener
- Move metal-debounce to this repo HOT 1
- Move metal-structs to this repo
- [metal-anim
- [metal-router] using window.onbeforeunload does not work for popstate events HOT 1
- [metal-useragent] User Agent is not being detected since v2.2.0 HOT 1
- [metal-storage] Doesn't work with jsdom @ >11.12.0 HOT 2
- [metal-drag-drop] Drag event doesn't propagate original event HOT 6
- [incremental-dom-string] Possible XSS injection when rendering server-side HOT 1
- [metal-drag-drop] Placeholder is added to the target list HOT 4
- [metal-drag-drop] Incorrect hovered items when there is horizontal scroll HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metal-plugins.