jQuery的模式窗口插件网上有很多,但都有大大小小的问题。始终不能满足我的需求。
前几天在园子里看到 [原创]仿QQ校友DIV模拟窗口 这篇文章
今天闲来无事,把文章中插件的 html 和 css 拿了过来 自己也写了一个插件。
很久没写插件了,就当温习了。写的代码真是太丑了。。
------------------------------------------------------------------------------
先来点效果图
---------------------------------------------------------------------------------
代码
/**
*jQuery弹出层插件
*
*汤晓华 tension
*
*2010/02/27 http://www.cnblogs.com/tandly
*
*本插件html代码以及css部分来自 http://www.cnblogs.com/fishbin/archive/2010/03/21/1690759.html
*
*
*/
(function($) {
$.fn.box = function(o) {
o = $.extend(
{
title: "意见反馈",
trigger: "",
parent: "none",
width: -1990,
height: -1990,
removeBtn: false,
buttons: [],
// buttons: [{ title: "确认", cssClass: "jBox-confirm", click: function(obj) {
// }
// }, { title: "取消", cssClass: "jBox-confirm", click: function(obj) {
// } }],
ok: function() { },
cancel: function() { },
close: function() { }
}, o || {});
$(this).attr("box_content", "true");
var width = o.width;
var height = o.height;
//弹出框的父容器
var parent;
var thisD = $(this);
if (o.parent == "none") {
parent = $($("div")[0]);
if (parent == null || parent.attr("box_content") == "true") {
parent = $("body");
}
}
else {
parent = $(o.parent);
}
/*以下是固定的HTML代码*/
var jBoxHolder = $('<div > onFooEndFunc(myfn);
$(o.trigger).click(function() {
jBoxWraper.open();
});
};
})(jQuery);
DEMO
https://files.cnblogs.com/tandly/jquery.box.rar
苏州 多云
汤晓华 QQ 1881597 MSN tension1990@hotmail.com
2010 03 27