87,907
社区成员
发帖
与我相关
我的任务
分享
#signup {
width: 470px;
padding-bottom: 2px;
display:none;
background: #FFF;
border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);
}
(function($){
$.fn.extend({leanModal:function(_1){
var _2={top:100,overlay:0.5};
_1=$.extend(_2,_1);
return this.each(function(){
var o=_1;$(this).click(function(e){
var _3=$("<div id='lean_overlay'></div>");
var _4=$(this).attr("href");
$("body").append(_3);
$("#lean_overlay").click(function(){_5(_4);});
var _6=$(_4).outerHeight();
var _7=$(_4).outerWidth();
$("#lean_overlay").css({"display":"block",opacity:0});
$("#lean_overlay").fadeTo(200,o.overlay);
$(_4).css({"display":"block","position":"fixed",opacity:0,"z-index":11000,"left":50+"%","margin-left":-(_7/2)+"px","top":o.top+"px"});
$(_4).fadeTo(200,1);e.preventDefault();});});
function _5(_8){$("#lean_overlay").fadeOut(200);$(_8).css({"display":"none"});};}});})(jQuery);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style>
#lean_overlay { position: fixed; z-index: 10000; top: 0px; left: 0px; height:100%; width:100%; background: #000; display: none; }
</style>
<script type="text/javascript" src="http://www.lvzhou168.com/js/jquery.js"></script>
<script>
(function ($) {
$.fn.extend({ leanModal: function (_1) {
var _2 = { top: 100, overlay: 0.5 }
, css1 = document.compatMode == 'CSS1Compat'
, ie6 = /msie 6/i.test(navigator.userAgent) || (!!document.all && !css1)//IE7+文档说明不是xhtml的也不支持fixed属性,只能按照ie6的方法来处理
;
_1 = $.extend(_2, _1);
return this.each(function () {
var o = _1; $(this).click(function (e) {
var _3 = $('#lean_overlay');
if (_3.size() == 0) {//修正点击多次重复添加背景
_3 = $("<div id='lean_overlay'></div>");
$("body").append(_3);
_3.click(function () { _5(_4); });
}
var _4 = $(this).attr("href");
var _6 = $(_4).outerHeight();
var _7 = $(_4).outerWidth();
_3.css({ "display": "block", opacity: 0 });
_3.fadeTo(200, o.overlay);
if (ie6) { //IE6设置width 100%,height:100%在CSS1Compat下好像么有用,直接设置为根节点的滚动高和宽得了
_3.css({ position: 'absolute', height: document[css1 ? 'documentElement' : 'body'].scrollHeight, width: document[css1 ? 'documentElement' : 'body'].scrollWidth });
//修正IE6滚动问题
$(window).scroll(function () { $(_4).css({ top: document[css1 ? 'documentElement' : 'body'].scrollTop + o.top }); });
}
$(_4).css({ "display": "block", "position": ie6 ? 'absolute' : "fixed", opacity: 100, "z-index": 11000, "left": 50 + "%", "margin-left": -(_7 / 2) + "px", "top": o.top + "px" });
$(_4).fadeTo(200, 1); e.preventDefault();
});
});
function _5(_8) { $("#lean_overlay").fadeOut(200); $(_8).css({ "display": "none" }); };
}
});
})(jQuery);
$(function () {
$('input[href]').leanModal();
});
</script>
<input type="button" href="#abc" value="打开登陆框"/>
<div style="height:1000px;"></div>
<div style="width:300px;height:200px;border:solid 1px black;display:none;background:#fff" id="abc">登陆框</div>
(function ($) {
$.fn.extend({ leanModal: function (_1) {
var _2 = { top: 100, overlay: 0.5 }
, css1 = document.compatMode == 'CSS1Compat'
, ie6 = /msie 6/i.test(navigator.userAgent) || (!!document.all && !css1)//IE7+文档说明不是xhtml的也不支持fixed属性,只能按照ie6的方法来处理
;
_1 = $.extend(_2, _1);
return this.each(function () {
var o = _1; $(this).click(function (e) {
var _3 = $('#lean_overlay');
if (_3.size() == 0) {//修正点击多次重复添加背景
_3 = $("<div id='lean_overlay'></div>");
$("body").append(_3);
_3.click(function () { _5(_4); });
}
var _4 = $(this).attr("href");
var _6 = $(_4).outerHeight();
var _7 = $(_4).outerWidth();
_3.css({ "display": "block", opacity: 0 });
_3.fadeTo(200, o.overlay);
if (ie6) { //IE6设置width 100%,height:100%在CSS1Compat下好像么有用,直接设置为根节点的滚动高和宽得了
_3.css({ position: 'absolute', height: document[css1 ? 'documentElement' : 'body'].scrollHeight, width: document[css1 ? 'documentElement' : 'body'].scrollWidth });
//修正IE6滚动问题
$(window).scroll(function () { $(_4).css({ top: document[css1 ? 'documentElement' : 'body'].scrollTop + o.top }); });
}
$(_4).css({ "display": "block", "position": ie6 ? 'absolute' : "fixed", opacity: 100, "z-index": 11000, "left": 50 + "%", "margin-left": -(_7 / 2) + "px", "top": o.top + "px" });
$(_4).fadeTo(200, 1); e.preventDefault();
});
});
function _5(_8) { $("#lean_overlay").fadeOut(200); $(_8).css({ "display": "none" }); };
}
});
})(jQuery);
#lean_overlay {
position: fixed;
z-index: 10000;
top: 0px;
left: 0px;
height:100%;
width:100%;
background: #000;
display: none;
}