jQuery makeDraggable 有更多技巧吗?
我已将另一个问题中的脚本添加到我正在使用的解决方案中,以使 jQueryUI 对话框能够拖动到文档原始边界之外。
这是脚本:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false
});
};
问题是,当我添加此脚本时,所有表单都变成了拖动手。这使得当对话框开始拖动操作时尝试滚动对话框时会出现问题。
我怎样才能只将对话框窗口标题栏作为拖动手柄(原始行为),但仍然摆脱遏制?
解决方案:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false,
handle: ".ui-dialog-titlebar"
});
};
谢谢约瑟夫!
I've added a script from another question on SO to a solution I'm working with to enable the jQueryUI Dialogs to be dragged outside the documents original boundaries.
This is the script:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false
});
};
The problem is that when I add this, all of the form becomes a drag-hande. That makes it problematic when trying to scroll a dialog when the dialog begins a drag operation instead.
How can I have just the dialog window titlebar as drag-handle (the original behaviour) but still get rid of the containment?
SOLUTION:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false,
handle: ".ui-dialog-titlebar"
});
};
Thank you Joseph!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用拖动手柄查找
Look up using drag handles