I'm having a brain fart and cannot seem to get the content of my jquery ui dialog to stop being 'draggable'. I turned off the draggable setting on the actual dialog pop-up, however, the content inside the box is still able to be dragged out of the box's view. I'd like to have a static positioned box and static positioned content within the box.
我有一个大脑屁,似乎无法得到我的jquery ui对话框的内容,以阻止'可拖动'。我关闭了实际对话框弹出窗口中的可拖动设置,但是,框内的内容仍然可以从框的视图中拖出。我想在盒子里面放一个静态定位盒子和静态定位内容。
Here is my code:
这是我的代码:
$('.LinkBtn').click(function (e) {
e.preventDefault();
var OfferID = $(this).attr('id').substring(8);
$('#HiddenLinks_' + OfferID).show();
newDialog(OfferID);
});
function newDialog(OfferID) {
var divObj = $('#HiddenLinks_' + OfferID);
var $dialog = divObj
.draggable()
.dialog({
draggable: false,
autoOpen: false,
resizable: false,
modal: false,
title: $('#HiddenLinks_' + OfferID).attr('title')
}).draggable(false);
$dialog.dialog('open');
return false
}
Thanks!
谢谢!
5 个解决方案
#1
9
$('#popup').dialog({
width: 600,
modal: true,
resizable: false,
draggable: false
});
In this example I disabled both draggable and resizable events on a dialog box.
在此示例中,我在对话框中禁用了可拖动和可调整大小的事件。
#2
5
$("#test_id").dialog({
display: 'block',
width: 500,
modal: true,
resizable: false,
draggable: false,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
#3
4
When you do: $("div").draggable({disabled:true})
the div becomes transparent, you can remove the class from disabled so this doesn't happen:$("div").removeClass(' ui-draggable-disabled ui-state-disabled');
当你这样做:$(“div”)。draggable({disabled:true})div变得透明,你可以从禁用中删除类,所以这不会发生:$(“div”)。removeClass('ui- draggable-disabled ui-state-disabled');
#4
3
You could also just set the draggable to false by:
你也可以通过以下方式将draggable设置为false:
$("div").draggable({disabled:true}) // this will disable dragging on a draggable object
$("div").draggable({disabled:false}) // this will enable dragging on a draggable object
#5
0
If you want to stop user from re-sizing your dialog box you can use below code.
如果要阻止用户重新调整对话框的大小,可以使用下面的代码。
$("#yourDivId").dialog("option", "resizable", false);
This will disallow user from re-sizing your dialog box.
这将禁止用户重新调整对话框的大小。
#1
9
$('#popup').dialog({
width: 600,
modal: true,
resizable: false,
draggable: false
});
In this example I disabled both draggable and resizable events on a dialog box.
在此示例中,我在对话框中禁用了可拖动和可调整大小的事件。
#2
5
$("#test_id").dialog({
display: 'block',
width: 500,
modal: true,
resizable: false,
draggable: false,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
#3
4
When you do: $("div").draggable({disabled:true})
the div becomes transparent, you can remove the class from disabled so this doesn't happen:$("div").removeClass(' ui-draggable-disabled ui-state-disabled');
当你这样做:$(“div”)。draggable({disabled:true})div变得透明,你可以从禁用中删除类,所以这不会发生:$(“div”)。removeClass('ui- draggable-disabled ui-state-disabled');
#4
3
You could also just set the draggable to false by:
你也可以通过以下方式将draggable设置为false:
$("div").draggable({disabled:true}) // this will disable dragging on a draggable object
$("div").draggable({disabled:false}) // this will enable dragging on a draggable object
#5
0
If you want to stop user from re-sizing your dialog box you can use below code.
如果要阻止用户重新调整对话框的大小,可以使用下面的代码。
$("#yourDivId").dialog("option", "resizable", false);
This will disallow user from re-sizing your dialog box.
这将禁止用户重新调整对话框的大小。