Jquery - 可将可拖动设置为从恢复 = 无效恢复 = true
当最初设置为“无效”时,是否可以将可拖动恢复值设置为“true”?我试图在可放置的放置事件中恢复可拖动,但恢复不会发生。
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});
}
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});
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
.draggable('option', 'revert', true)
仅供参考,这是更改任何 jQuery UI 小部件选项的常规方法,也在文档中进行了解释。
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.