You can add containment dynamically like this:
$(this).draggable( "option", "containment", "parent" );
How do i remove the containment again? Like:
$(this).draggable( "option", "containment", "none" );
except that doesn't work.. I could not find any methods for it in the API documentation
EDIT: I want to be able to drag the item but with no containment. I am using this with checkboxes:
var denne = $(this);
if ($('#containment').is(':checked')) {
$(this).draggable( "option", "containment", "parent" );
}
$("#containment").each(function(){
if ($(this).prop('checked')==false){
denne.draggable( "option", "containment", false );
}
});