GithubHelp home page GithubHelp logo

Comments (3)

diegonvs avatar diegonvs commented on September 7, 2024 1

Thanks for clarification @p2kmgcl! I'll take a look on this!

from metal-plugins.

diegonvs avatar diegonvs commented on September 7, 2024

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.

p2kmgcl avatar p2kmgcl commented on September 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.