/** * 蒙层 */ (function($){ $.Mask = { show: function(str) { var width = $("body").width(); var height = $("body").height(); var wb = $(window).height(); var divMask = '
'; var divTxt = '
' + str + '
'; $("body").append(divMask).append(divTxt); var divTxtWidth = $("#maskTxt").outerWidth(); var divTxtHeight = $("#maskTxt").outerHeight(); var left = (width - divTxtWidth) / 2; var top = (height - divTxtHeight) / 2; if (wb > height) { height = wb; } else { height += 62; } $("#mask").css("height", height + "px"); $("#maskTxt").css({"left": left + "px", "top": top + "px"}); }, hidden: function() { $("#mask").remove(); $("#maskTxt").remove(); } }; }(jQuery));