What i’m tryinjg to do:
Turn a div as draggable , then make a button to reset her position as default.
the question is, why i cant set the right position of a absolute div, after i set as draggable ?
edit: dragg the div first and then click in the button.
$('div').draggable();
$('#button').click(function(){
$('div').draggable('destroy').css({ // destroy was only a test
top: 0,
right: 0 // nothing happens
});
});
the position only work if i use left.
edit 2: the reason i’m not using the left position, its because if i zoom in, will overlay other things. Any tips, be my guest.
What i’m missing ?
It’s because
$.draggable()setsleftas you drag the div around, and it stays set after you call$.draggable('destroy')Just reset left using
left: auto;http://jsfiddle.net/9uLCY/7/