Alex Rivera | Logout

jquery draggable options

Asked 2009-06-24T20:48:57.937
11

i want the draggable object to revert back to its original position when i click a button. i used 'destroy' option but it doesnt seem to work. it disables the dragging but doesnt revert back to original position.

can someone help?

EDIT PART:

$('#Zoom').toggle(function() {
                $("#draggable").draggable({});},
            function() {
                $("#draggable").draggable('destroy');});

this is a toggle button that i am using to enable dragging. the destroy option only disables dragging and does not revert the object back to the original position.

also this is the button i want to make the object come back to its original position:

nextImg.addEventListener('click', function() {img.setAttribute("src", "img"+(++imgnum)+".jpg");}, false);
Edit
Report

1 Answer

-1

Revert option is set to false by default, you've to set it to true.

$("#draggable").draggable({ 
    revert: true
});

this should do it actually...

answered 2009-06-24T22:30:35.657

Your Answer