Can't change/disable Draggable Containment after setting to parent
MAY have actually found a bug here...
- $(targetObject).draggable({
- drag: function (e, ui) {
- $("#rptSlideLayerEdits_ctl0" + layernum + "_tbXPos").val(theLeft);
- $("#rptSlideLayerEdits_ctl0" + layernum + "_tbYPos").val(theTop);
- },
- stop: function (e, ui) {
- saveLayer(currentLayerNumber);
- },
- containment: "parent"
- });
So, this is the code that sets up the draggable. I have a little lock icon, when you click it, it runs this function:
- function disableLayerConstraint(){
- $(".layerCons").attr("src", "images/mb_unlock.png");
- $(targetObject).draggable({containment: null });
- }
I've tried null,"", and undefined to disable the constraint (there was no documentation on how to disable a constraint). Now everything works as expected, unless you drag it first. So, load the page, click the unlock, and I can drag it wherever I want. BUT, load the page, drag the object, THEN click the lock, it's still contained to parent.
Can anyone recreate this issue and confirm it's a bug?
I'm running the latest version of jQuery and UI.
Thanks!