AshesOfOwls / jquery.shapeshift

A dynamic grid system with drag and drop functionality.
http://ashesofowls.github.com/jquery.shapeshift/
MIT License
1.67k stars 312 forks source link

Capturing a drop #51

Closed tm0054 closed 11 years ago

tm0054 commented 11 years ago

Ok, I know this is more of a tech support issue but...

I've been all over the documentation multiple times and I still can't figure out how you're supposed to catch a dropped object. That is listen for when something is moved.

Basically when somebody drops something I want to capture the new position of the object, create a querystring that will go to a page and update my database with the object's new position.

My code lives in the general script tags area of my site inside the head tag.

Right now I just have an alert to see if the code is picking up the event so here is my code (I've also tried using console.log and it is not being logged):

$containers = $(".container");

$containers.on("ss-arranged", function(e) {
    alert("EVENT FIRED");
});

I've also tried ss-event-dropped and ss-rearranged and nothing is firing.

So far, I can't make anything work as far as listening for events. I am sure I am doing something stupid. Other than that the dragging is working great.

AshesOfOwls commented 11 years ago

Weird, it seems as though everything is fine in terms of that specific code, I copied and pasted it into the basic demo and it seems to be fine.

I can't really offer any more troubleshooting unless I saw the actual demo. One thing you could try is to see if the listener is actually on the page by manually triggering it:

$(".container").trigger("ss-arranged")

If it doesn't give you that alert then for some reason the code for the listener isn't being included in the page. Otherwise it would have to be troubleshooted more in depth. If so is there any chance you could do a js fiddle for it? There are already some JS Fiddles set up so you can fork it: http://jsfiddle.net/McPants/LNysC/

Feel free to ask as many questions as you need

tm0054 commented 11 years ago

Thanks for the quick response! I got it firing using JS Fiddle. I'm going to try to set it up to pass along the ID and position of an object to my function.

tm0054 commented 11 years ago

Got it working- thanks again for your help! I think I can safely call this one closed.

AshesOfOwls commented 11 years ago

Sweetness