Persistent draggable snap problem
Hello,
Just had a quick question about the snap abilities of a draggable div.
I'm using the "stop" param to trigger an ajax call to update the div's
position for persistence.
The problem is that if a div "snaps" to another div/container, the
drag:stop param isn't triggered (ie it's not being dragged anymore -
it snapped automatically).
This is like what I currently have:
$("div#box").draggable({
grid: [2,2],
snap: true,
snapTolerance: 4,
containment: "div#box_container",
stop: function() {
alert(' i was dragged ');
}
});
When the div gets within 4 pixels ("snapTolerance: 4") of any parent
border, it will "pop" into place without triggering "stop" so the
alert never shows and the position never gets saved even though it
moved.
When I refresh the page, the boxes are in the position they where
before they snapped.
In place of the alert is a bunch of code that saves the boxes
position.
Just wondering how I can trigger an event with the snap param, like:
$("div#box").draggable({
grid: [2,2],
snap: true,
snapTolerance: 4,
containment: "div#box_container",
stop: function() {
alert(' i was dragged ');
}
// LIKE...
snapStop: function() {
alert(' i was snapped ');
}
onSnap: function() {
alert(' i was snapped ');
}
});
But I don't see anything in the documentation relating to this.
Thanks in advance.