jon
jon

Reputation: 1581

How can you implement jquery stack for draggable ui?

Why does the following not work... if I remove the stack option, the divs are draggable but they do not stack properly...

$(function() {
    $( ".draggable_div" ).draggable({ stack: ".draggable_div" });
});

Any ideas?... ps. the sample code on the jquery site also doesn't work... although there example does work... http://jqueryui.com/demos/draggable/#option-stack

I have tried the following and this works.. but i don't know why?... if someone could explain that would be great...

$(function() {
    $( ".draggable_div" ).draggable({ stack: { group: "*", min: 50 } });
});

Kind regards J

Upvotes: 0

Views: 116

Answers (2)

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76880

You should use a valid selector for stack

$(function() {
    $( ".draggable_div" ).draggable({ stack: ".draggable_div" });
});
</script>

Upvotes: 0

GregL
GregL

Reputation: 38113

stack is a selector, and "draggable_div" is not a valid selector (unless you have a <draggable_div> in your XML).

Try adding a . before it:

$(function() {
    $( ".draggable_div" ).draggable({ stack: ".draggable_div" });
});

Upvotes: 1

Related Questions