AshesOfOwls / jquery.shapeshift

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

Trying to create a trash with no div in it #47

Closed thoma202 closed 11 years ago

thoma202 commented 11 years ago

Hi,

I was wondering if you have to at least insert one div in a container make the shapeshift work ?

I've tried something like that :

```

with a script which is the following : 

$(".liste").shapeshift({
                minColumns: 3, 
                enableCrossDrop: false,
                dragClone: true,
                deleteClone: true,
    });

$(".canvas").shapeshift({
        minColumns: 3, 

    });

$(".trash").shapeshift({
    enableTrash: true
});


But it seems that you can't drag a div into a container if it is empty. Do you confirm ? 

Thanks, really cool plugin by the way
AshesOfOwls commented 11 years ago

Yeah this is actually a bug that has a slight workaround. When shapeshift initializes it will search the container for the first child element and then generate a column grid based on that first childs width. The problem is that a container with no children will disallow shapeshift from creating that grid and therefore it crashes.

The workaround is to add the option of colWidth: , where \ is equal to any integer. So your new script would be:

$(".liste").shapeshift({ minColumns: 3, enableCrossDrop: false, dragClone: true, deleteClone: true, colWidth: 100 })

The integer doesn't have to be a specific number, any will do. I will address this problem in version 3.0 which I expect will be done sometime around mid July.

Thanks!

AshesOfOwls commented 11 years ago

This is now pushed to 3.0 which will be released within the next month.