您的位置:首页 > Web前端 > JQuery

jquery 仿模态对话框插件

2010-05-07 21:17 309 查看
jquery 仿模态对话框插件

演示: http://blue.bokequn.cn/demos/modalbox/demo/demos.html

版本库地址: http://code.google.com/p/jquery-plugin-modalbox/

jquery.modalbox 是一个轻量级的对话框插件, 支持模态, URL 加载, 拖动.

因为项目上的需求, 而在网上寻找很久后, 找到 weebox 好像符合要求, 用后发现每次弹出窗口 IE 内存狂增(4M以上), 在关闭后却不会释放, 无奈只能放弃....最终产生了这个东西..

主要功能:

1, 模态化显示(背景内容不可编辑)

2, 限制在窗口内拖动.

3, 窗口标题,确定,取消按钮可选择显示与否.

4, 窗口内容支持三种格式:

a. HTML 文本

b. jquery selector: 以 content 指定的 jquery selector 筛选出第一个 jquery 对象的 HTML 文本.

c. url: 以 iframe 加载 content 页面内容.

调用例子:

$.modalbox.show({
modal: true, // 模态
contentType: "url", // 加载 Url
content: "demos.child.html" // 要加载的地址
});

支持的属性及默认值:

{
title: '',
contentType: 'html', // html selector url
content: "", // 依据 contentType 而定
width: 400,
height: 200,

draggable: true,
modal: true,
scroll: "y", // x y no auto

showTitle: true,
showCancel: true,
showOk: true,

okBtnName: 'OK',
cancelBtnName: 'Cancel',
zIndex: 900,
onclose: null, // function 关闭后执行
onopen: null, // function, 只有返回true时才会显示窗口
onok: null, // function 点击确定按钮后,窗口关闭前执行
oncancel: null // function 点击取消按钮后,窗口关闭前执行
}

其他说明: 模态方式如果想支持 IE6, 需要bgiframe.js 插件修正下拉框 bug.

使用过程中若有问题或建议,欢迎提出来共同探讨,我的QQ: 122042523

版本库地址: http://code.google.com/p/jquery-plugin-modalbox/

演示: http://blue.bokequn.cn/demos/modalbox/demo/demos.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: