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

Leaving out elements from being draggable. #56

Closed tm0054 closed 11 years ago

tm0054 commented 11 years ago

Sorry for two questions, but is it possible to selectively leave out certain elements from being able to be dragged?

AshesOfOwls commented 11 years ago

Sorry for the delay in aswering this.

The selector option will accept any regular jQuery/CSS selector as a value. So if you want to select all list items except those with the class of ".dont-select-me", you would do:

$container.shapeshift({
  selector: "li:not(.dont-select-me)"
});

For more information about what selectors are available check out this link: http://api.jquery.com/category/selectors/

tm0054 commented 11 years ago

Thanks!

tm0054 commented 11 years ago

I know this is closed, but I'm combining a few things to attempt to get the results I am looking for. In some events I want the first object to always occupy the first spot. I don't want it to be able to be dragged or dragged over. In your docs I found a few commands that in description sound like they might help me achieve that goal:

                $(".container").shapeshift({
                    handle: '.dragger',
                    dragWhitelist: '.draggable',
                    cutoffStart: 2
                });

This is the code I am using. The 'dragWhiteList' command works great. You can't drag the first item as it's not set to draggable.

cutoffStart sounds like what I would need in order to stop things from dragging over the first item, but I'm not sure if I am using it correctly. Anyhow, what I have there isn't stopping anything from dragging over the first item