⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jquery.blockui.js

📁 Piwik#Opensourcewebanalytics一款可以和GOOGLE媲美的开源统计系统,运用AJAX.功能强大.无色提示:按照需要PHP5.1以上和MySQL数据库支持。
💻 JS
📖 第 1 页 / 共 2 页
字号:
/* * jQuery blockUI plugin * Version 1.33  (09/14/2007) * @requires jQuery v1.1.1 * * $Id$ * * Examples at: http://malsup.com/jquery/block/ * Copyright (c) 2007 M. Alsup * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function($) {/** * blockUI provides a mechanism for blocking user interaction with a page (or parts of a page). * This can be an effective way to simulate synchronous behavior during ajax operations without * locking the browser.  It will prevent user operations for the current page while it is * active ane will return the page to normal when it is deactivate.  blockUI accepts the following * two optional arguments: * *   message (String|Element|jQuery): The message to be displayed while the UI is blocked. The message *              argument can be a plain text string like "Processing...", an HTML string like *              "<h1><img src="busy.gif" /> Please wait...</h1>", a DOM element, or a jQuery object. *              The default message is "<h1>Please wait...</h1>" * *   css (Object):  Object which contains css property/values to override the default styles of *              the message.  Use this argument if you wish to override the default *              styles.  The css Object should be in a format suitable for the jQuery.css *              function.  For example: *              $.blockUI({ *                    backgroundColor: '#ff8', *                    border: '5px solid #f00, *                    fontWeight: 'bold' *              }); * * The default blocking message used when blocking the entire page is "<h1>Please wait...</h1>" * but this can be overridden by assigning a value to $.blockUI.defaults.pageMessage in your * own code.  For example: * *      $.blockUI.defaults.pageMessage = "<h1>Bitte Wartezeit</h1>"; * * The default message styling can also be overridden.  For example: * *      $.extend($.blockUI.defaults.pageMessageCSS, { color: '#00a', backgroundColor: '#0f0' }); * * The default styles work well for simple messages like "Please wait", but for longer messages * style overrides may be necessary. * * @example  $.blockUI(); * @desc prevent user interaction with the page (and show the default message of 'Please wait...') * * @example  $.blockUI( { backgroundColor: '#f00', color: '#fff'} ); * @desc prevent user interaction and override the default styles of the message to use a white on red color scheme * * @example  $.blockUI('Processing...'); * @desc prevent user interaction and display the message "Processing..." instead of the default message * * @name blockUI * @param String|jQuery|Element message Message to display while the UI is blocked * @param Object css Style object to control look of the message * @cat Plugins/blockUI */$.blockUI = function(msg, css, opts) {    $.blockUI.impl.install(window, msg, css, opts);};// expose version number so other plugins can interogate$.blockUI.version = 1.33;/** * unblockUI removes the UI block that was put in place by blockUI * * @example  $.unblockUI(); * @desc unblocks the page * * @name unblockUI * @cat Plugins/blockUI */$.unblockUI = function(opts) {    $.blockUI.impl.remove(window, opts);};/** * Blocks user interaction with the selected elements.  (Hat tip: Much of * this logic comes from Brandon Aaron's bgiframe plugin.  Thanks, Brandon!) * By default, no message is displayed when blocking elements. * * @example  $('div.special').block(); * @desc prevent user interaction with all div elements with the 'special' class. * * @example  $('div.special').block('Please wait'); * @desc prevent user interaction with all div elements with the 'special' class * and show a message over the blocked content. * * @name block * @type jQuery * @param String|jQuery|Element message Message to display while the element is blocked * @param Object css Style object to control look of the message * @cat Plugins/blockUI */$.fn.block = function(msg, css, opts) {    return this.each(function() {		if (!this.$pos_checked) {            if ($.css(this,"position") == 'static')                this.style.position = 'relative';            if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE            this.$pos_checked = 1;        }        $.blockUI.impl.install(this, msg, css, opts);    });};/** * Unblocks content that was blocked by "block()" * * @example  $('div.special').unblock(); * @desc unblocks all div elements with the 'special' class. * * @name unblock * @type jQuery * @cat Plugins/blockUI */$.fn.unblock = function(opts) {    return this.each(function() {        $.blockUI.impl.remove(this, opts);    });};/** * displays the first matched element in a "display box" above a page overlay. * * @example  $('#myImage').displayBox(); * @desc displays "myImage" element in a box * * @name displayBox * @type jQuery * @cat Plugins/blockUI */$.fn.displayBox = function(css, fn, isFlash) {    var msg = this[0];    if (!msg) return;    var $msg = $(msg);    css = css || {};    var w = $msg.width()  || $msg.attr('width')  || css.width  || $.blockUI.defaults.displayBoxCSS.width;    var h = $msg.height() || $msg.attr('height') || css.height || $.blockUI.defaults.displayBoxCSS.height ;    if (w[w.length-1] == '%') {        var ww = document.documentElement.clientWidth || document.body.clientWidth;        w = parseInt(w) || 100;        w = (w * ww) / 100;    }    if (h[h.length-1] == '%') {        var hh = document.documentElement.clientHeight || document.body.clientHeight;        h = parseInt(h) || 100;        h = (h * hh) / 100;    }    var ml = '-' + parseInt(w)/2 + 'px';    var mt = '-' + parseInt(h)/2 + 'px';    // supress opacity on overlay if displaying flash content on mac/ff platform    var ua = navigator.userAgent.toLowerCase();    var opts = {        displayMode: fn || 1,        noalpha: isFlash && /mac/.test(ua) && /firefox/.test(ua)    };    $.blockUI.impl.install(window, msg, { width: w, height: h, marginTop: mt, marginLeft: ml }, opts);};// override these in your code to change the default messages and styles$.blockUI.defaults = {    // the message displayed when blocking the entire page    pageMessage:    '<h1>Please wait...</h1>',    // the message displayed when blocking an element    elementMessage: '', // none    // styles for the overlay iframe    overlayCSS:  { backgroundColor: '#fff', opacity: '0.5' },    // styles for the message when blocking the entire page

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -