jQuery 可调整大小的错误
我在尝试将它与 jQuery UI 的对话框一起使用时,在 jQuery UI 的 Resizable 中遇到了一个错误,当给定选择器或 DOM 元素时,它不尊重 containment
选项,并且通常在调整大小时表现得非常奇怪。
我基本上是这样做的:
dialog = $('<div>...</div>').dialog(options)
dialog.parent().draggable(options).resizable(options)
所以我需要另一种方法来进行大小调整的遏制。
有没有办法可以模拟遏制,也许通过 resizing
调用的 resize
回调?我可以在哪里检查 div
在调整大小时是否太大,并强制其达到可接受的大小?
I'm experiencing a bug in jQuery UI's Resizable trying to use it with jQuery UI's dialog, where it's not respecting the containment
option when given a selector or a DOM element, and generally behaving very weirdly on resize.
I'm basically doing this:
dialog = $('<div>...</div>').dialog(options)
dialog.parent().draggable(options).resizable(options)
So I need another way to do containment for resizing.
Is there a way I can simulate containment, maybe via the resize
callback of the resizable
call? Where I could maybe check if the div
would be too big on resize, and force it to an acceptable size?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我的经验,您不能只在对话框对象本身上调用
.draggable()
。它也无法帮助 jQueryUI 将每个对话框元素重新设置为
标记。
尝试一下:
请注意,这种隐藏 jQueryUI 内部结构 (
.uiDialog
) 的使用可能会在未来版本中中断。In my experience, you can't just call
.draggable()
on the dialog object itself.It also doesn't help the jQueryUI reparents every dialog element into the
<body>
tag.Try this:
Note that this use of hidden jQueryUI internals (
.uiDialog
) may break in future versions.