Is it possible to set a draggables revert value to "true" when it was originally set to "invalid"? I am trying to revert the draggable in the drop event of the droppable, but the revert doesnt happen.
var dragOpts = {
/* appendTo: "body", */
zIndex: 1000,
cursor: "move",
revert: "invalid",
opacity: 0.45,
helper: myHelper,
};
$(".appointment").draggable(dragOpts);
function myHelper(event, ui) {
var height = $(this).children().not('.travel-element').css("height");
var cloneClass = $(this).children().not('.travel-element').attr("class");
return $("<div id='helper' class='" + cloneClass + "' style='height:" + height + "'>Moving</div>");
}
drop: function (e, ui) {
$(".appointment").draggable({revert:true});
}
Use .draggable('option', 'revert', true)
Fyi, this is the regular way to change options for any jQuery UI widget and also explained in the docs.