Jump to content

Drag and Drop between Start and Target Divs


JimTEFL
 Share

Recommended Posts

I can drag and drop draggable elements onto targets but need to compare the source div with the target div so that I can control where I drop the dragged element. The drag/drop functions identify the target divs but not the source divs.

I want to be able to compare as follows:

There are 32 target divs. Let the draggable element be on source div6.

It can be moved onto div2, div3, div10 or div11, so:-

 

if(div6 - targetdiv == -2 or -3 or 4 or 5) {return;} [to allow a valid drop]

else {return:false;} [to prevent invalid drop]

 

How can I identify the source div, please, to control my drag drops?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...