Issue #2310Opened October 5, 2019by AbdallaMohammed1 reactions

[QUESTION] How can I specify position for dragging elements ?

Question

Hi iam doing a project with this library and i want to specify position for dragging components in it for example i have a div with id="drag-here" i want all components to be dragged in this div only

i hope you can understand me , thank you all

Answers (3)

pouyamiralayiOctober 6, 20191 reactions

i don't have components iam using blocks

according to this:

i have a div with id="drag-here"

i assume your block is something like this:

content: '<div id="drag-here"></div>'

the approach for your container block would be:

editor.BlockManager.add('drag-here',{
    lablel:'Drag Here',
    content:'<div id="drag-here" data-gjs-droppable="true" style="width:100px;height:100px; background:red;"></div>'
})

and for target blocks:

editor.BlockManager.add('drop',{
    lablel:'Drop',
    content:'<div data-gjs-draggable="div#drag-here" style="width:50px;height:50px; background:blue;"></div>'
})

cheers!

pouyamiralayiOctober 5, 20190 reactions

i have a div with id="drag-here" i want all components to be dragged in this div only

if by this you mean you want all components to be draggable only in your target component, you can use draggable property. by specifying draggable on your components like this:

draggable: 'target, target *'

cheers!

AbdallaMohammedOctober 6, 20190 reactions

by specifying draggable on your components like this:

thank you for fast replay , but i don't have components iam using blocks

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.