使用 jQuery 创建模式面板
我想弹出一个面板(如没有标题栏或调整大小的弹出窗口),其中背景变暗。如果单击深色背景,面板将关闭。
是否有一些好的简单库可以像 jQuery UI 的对话框一样执行此操作?我很想使用 jQuery UI,但它们的模式对话框窗口有一个带有关闭按钮的标题栏,我无法轻松删除。
理想情况下,面板会在鼠标光标旁边弹出(如果太靠近浏览器边框,则适当移动)。
I want to popup a panel (like a popup window without the title bar or resize) where the background is darkened. If you click on the darkened background the panel is closed.
Is there some good simple library for doing this like jQuery UI's dialog? I would love to use jQuery UI, but their modal dialog windows have a title bar with close button I can't easily remove.
Ideally the panel popups up next to the mouse cursor (appropriately moving if too close to the browser's border).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用一些 CSS 删除 JQuery UI 的对话框标题栏(或仅删除关闭按钮):
然后将其添加到dialogClass 属性中:
You can also remove the JQuery UI's dialog title bar (or only the close button) with a few of CSS:
Then add it to the dialogClass property:
您看过 SimpleModal 吗?
您可以下载一些演示作为基础或学习。您还可以直接在 Google 代码上下载该库。
您需要做的就是包含 JS 文件,设置一些默认样式(CSS 或作为选项),然后就可以了:
您可以包含您的选项,如下所示:
Have you looked at SimpleModal?
There are a few demos that you can download to use as a base or for learning. You can also download the library directly on Google code.
All you need to do is include the JS file, set some default styles (CSS or as options) and away you go:
You can include your options as follows:
我真的很喜欢 JQuery Tools 中的覆盖对话框。它在对话框后面有一个遮罩选项,请在此处进行演示。
I really like the overlay dialog from JQuery Tools. It has an option for a mask behind the dialog box, demoed here.