js 遮罩層 loading 效果

//調用方法

//關閉事件<button οnclick='LayerHide()'>關閉</button>,在loadDiv(text)中,剔除出來

//調用LayerShow(text),text為參數,可以寫入想要寫入的提示語

//本方法在調用時會自動生成一個添加到body的div,并且會在調用隱藏遮罩層 LayerHide()時刪除div

//封裝遮罩層div顯示效果

//將其放在頁面的div中加載

?

function loadDiv(text) {var div = "<div id='_layer_'> <div id='_MaskLayer_' style='filter: alpha(opacity=30); -moz-opacity: 0.3; opacity: 0.3;background-color: #000; width: 100%; height: 100%; z-index: 1000; position: absolute;" +                 "left: 0; top: 0; overflow: hidden; display: none'></div><div id='_wait_' style='z-index: 1005; position: absolute; width:430px;height:218px; display: none'  ><center><h3>" +                 "" + text + "<img src='../images/loading.gif' /></h3><button οnclick='LayerHide()'>關閉</button></center></div></div>"; return div; 
}

?

//觸發遮罩層

function LayerShow(text) {var addDiv= loadDiv(text);  var element = $("#" + addDiv).appendTo(document.body);     $(window).resize(Position);  var deHeight = $(document).height();    var deWidth = $(document).width();    Position();     
$("#_MaskLayer_").show();   $("#_wait_").show();} 

?

//獲取相對位置

 function Position() {  $("#_MaskLayer_").width($(document).width());   var deHeight = $(window).height();     var deWidth = $(window).width();     $("#_wait_").css({ left: (deWidth - $("#_wait_").width()) / 2 + "px", top: (deHeight - $("#_wait_").height()) / 2 + "px" }); 
}

?

//隱藏遮罩層

 function LayerHide() { $("#_MaskLayer_").hide(); $("#_wait_").hide(); del(); 
}

?

//清空div,避免產生重復

 function del() { var delDiv = document.getElementById("_layer_");     delDiv.parentNode.removeChild(delDiv); //刪除 }

?

轉載于:https://www.cnblogs.com/WangJinYang/archive/2012/10/09/2716965.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377167.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377167.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377167.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

centos6.5安裝配置LDAP服務[轉]

centos6.5安裝配置LDAP服務[轉] 安裝之前查一下 1find / -name openldap*centos6.4默認安裝了LDAP&#xff0c;但沒有裝ldap-server和ldap-client 于是yum安裝 1su root2yum install -y openldap openldap-servers openldap-clients不建議編譯源碼包&#xff0c;有依賴比較麻煩…

《MySQL——恢復數據-誤刪行、表、庫》

目錄誤刪行事前預防誤刪行數據方法誤刪表/庫延遲復制備庫事前預防誤刪庫/表方法傳統的架構不能預防誤刪數據&#xff0c;因為主庫的一個drop table命令&#xff0c;會通過binlog傳給所有從庫和級聯從庫&#xff0c;進而導致整個集群的實例都會執行這個命令。 MySQL相關的誤刪除…

python圖例位置_Python | 圖例位置

python圖例位置Legends are one of the key components of data visualization and plotting. Matplotlib can automatically define a position for a legend in addition to this, it allows us to locate it in our required positions. Following is the list of locations…

Freemarker中遍歷List實例

Freemarker中如何遍歷List摘要&#xff1a;在Freemarker應用中經常會遍歷List獲取需要的數據&#xff0c;并對需要的數據進行排序加工后呈現給用戶。那么在Freemarker中如何遍歷List&#xff0c;并對List中數據進行適當的排序呢&#xff1f;通過下文的介紹&#xff0c;相信您一…

工作總結:文件對話框的分類(C++)

原文地址&#xff1a;http://www.jizhuomi.com/software/173.html 文件對話框分為打開文件對話框和保存文件對話框&#xff0c;相信大家在Windows系統中經常見到這兩種文件對話框。例如&#xff0c;很多編輯軟件像記事本等都有“打開”選項&#xff0c;選擇“打開”后會彈出一個…

《MySQL——Innodb改進LRU算法》

Innodb改進LRU.算法&#xff0c;實質上將內存鏈表分成兩段。 靠近頭部的young和靠近末尾的old&#xff0c;取5/12段為分界。 新數據在一定時間內只能在old段的頭部&#xff0c;當在old段保持了一定的時間后被再次訪問才能升級到young。 實質上是分了兩段lru&#xff0c;這樣做的…

nfc/nfc模式_NFC的完整形式是什么?

nfc/nfc模式NFC&#xff1a;沒有進一步評論 (NFC: No Further Comment) NFC is an abbreviation of "No Further Comment". NFC是“沒有進一步評論”的縮寫 。 It is an expression, which is commonly used in messaging or chatting on social media networking s…

dx小記(2)

1.構造一個平截臺體&#xff08;Frustum&#xff09; 最近距離-projMatirx.43/projMatrix.33 projMatrix。33 深度/&#xff08;深度-最近距離&#xff09; projMatrix。44-最近距離*&#xff08;深度/&#xff08;深度-最近距離&#xff09;&#xff09; FrustumMatrix proje…

jQuery: 整理4---創建元素和添加元素

1.創建元素&#xff1a;$("內容") const p "<p>這是一個p標簽</p>" console.log(p)console.log($(p)) 2. 添加元素 2.1 前追加子元素 1. 指定元素.prepend(內容) -> 在指定元素的內部的最前面追加內容&#xff0c;內容可以是字符串、…

Design a high performance cache for multi-threaded environment

如何設計一個支持高并發的高性能緩存庫 不 考慮并發情況下的緩存的設計大家應該都比較清楚&#xff0c;基本上就是用map/hashmap存儲鍵值&#xff0c;然后用雙向鏈表記錄一個LRU來用于緩存的清理。這篇文章 應該是講得很清楚http://timday.bitbucket.org/lru.html。但是考慮到高…

《MySQL——join語句優化tips》

目錄要不要用joinJoin驅動表選擇Multi-Range Read優化Batched Key Access &#xff08;BKA&#xff09;對NLJ進行優化BNL算法性能問題BNL轉BKA要不要用join 1、如果使用的是Index Nested-Loop Join算法&#xff0c;即可以用上被驅動表的索引&#xff0c;可以用 2、如果使用的…

scala中抽象類_Scala中的抽象類

scala中抽象類抽象類 (Abstract Class) In the Scala programming language, abstraction is achieved using abstract class. 在Scala編程語言&#xff0c; 抽象是使用抽象類來實現的。 Abstraction is the process of showing only functionality and hiding the details fr…

不能catch Fatal的exception

Clemens Vasters - Are you catching falling knives?里給了一個判斷C#的exception是不是fatal的代碼&#xff0c;可以參考參考。 public static bool IsFatal(this Exception exception) {while (exception ! null){if (exception as OutOfMemoryException ! null &&…

HDU 2824 The Euler function

篩法計算歐拉函數 #include <iostream> #include <cstdio> using namespace std; const int maxn3000005; long long phi[maxn]; int main(){int i,j,a,b;for(i1;i<maxn;i) phi[i]i;for(i2;i<maxn;i2) phi[i]/2;for(i3;i<maxn;i2)if(phi[i]i){for(ji;j<…

LinkChecker 8.1 發布,網頁鏈接檢查

LinkChecker 8.1 可對檢查時間和最大的 URL 數量進行配置&#xff1b;當使用 HTTP 請求時發送 do-not-track 頭&#xff1b;生成 XML 的 sitemap 用于搜索引擎優化&#xff1b;檢測 URL 長度和重復的頁面內容&#xff1b;修復了很多檢查的 bug。 LinkChecker 是一個網頁鏈接檢查…

c語言語言教程0基礎_C語言基礎

c語言語言教程0基礎Hey, Folks here I am back with my second article on C language. Hope you are through with my previous article C language - History, Popularity reasons, Characteristics, Basic structure etc. In this one, I will cover some fundamental conce…

《MySQL——臨時表》

內存表與臨時表區別 臨時表&#xff0c;一般是人手動創建。 內存表&#xff0c;是mysql自動創建和銷毀的。 內存表&#xff0c;指的是使用Memory引擎的表&#xff0c;建表語法&#xff1a;create table ... engine memeory 表的數據存在內存里&#xff0c;系統重啟后會被清…

android中ActionBar的幾個屬性

actionBar.setHomeButtonEnabled //小于4.0版本的默認值為true的。但是在4.0及其以上是false&#xff0c;該方法的作用&#xff1a;決定左上角的圖標是否可以點擊。沒有向左的小圖標。 true 圖標可以點擊 false 不可以點擊。 actionBar.setDisplayHomeAsUpEnabled(true) //…

drei

模擬9 T3 &#xff08;COGS上也有&#xff0c;鏈接http://218.28.19.228/cogs/problem/problem.php?pid1428&#xff09; 題目描述 輸入a&#xff0c;p&#xff0c;求最小正整數x&#xff0c;使得a^x mod p 1。 分析 神奇的歐拉定理&#xff08;對于gcd&#xff08;a&#xf…

《MySQL——group by使用tips》

1、如果對group by語句結果沒有排序要求&#xff0c;在語句后面加order by null 2、盡量讓group by 過程用上索引&#xff0c;確認方法是explain結果里沒有Using temporary 和Using filesort 3、如果group by 需要統計的數據量不大&#xff0c;盡量只使用內存臨時表&#xff…