Getting Images Positions After Dragging and Dropping

A

Anonymous

Guest
Hey Everyone,

I'm not too good with javascript and jquery myself.

I want to use the jquery UI (draggable and dropable) to make a system where you have images and you drop them onto one MAIN image. Then get the positions of where them images are and feed back that result to a php file, where I could do the rest.

I'm not sure how I'd do this, could someone just tell me HOW I'd do it?

Thank you.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 Year Old Programmer & Graphic Artist, Confident and Courageous
 
Do you need to just figure out how to get the positions? Or do you also need to know how to make dragable and dropable items?
 
Figure out the positions and how I'd send them to a php file
 
These will give you the x and y offsets of whatever element you ask for. You should use unique "id" to reference each element.

Code:
var x = $("#element").offset().left;
var y = $("#element").offset().top;

To send the information to PHP for storage or manipulation you can either use more JQuery or JavaScript to push the values into hidden fields on a form you are submitting.

Or if you don't want to reload the page you can have some sort of trigger that calls a PHP script using AJAX and send that script these variables.
 
Back
Top