国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery實現頁面加載效果

2019-11-19 17:28:30
字體:
來源:轉載
供稿:網友

1、說明

Jquery頁面加載可實現異步請求時提示“請稍后,正在加載...”效果,同步請求不可用(即ajax async: false)。

2、代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jquery頁面加載特效</title> <style type="text/css"> * {  margin: 0;  padding: 0;  list-style-type: none; } a, img {  border: 0; } .loading {  margin: 100px auto 0 auto;  width: 400px;  text-align: center;  font-size: 18px; } .loading .action {  text-decoration: none;  font-family: "微軟雅黑" , "宋體"; } .cover {  position: fixed;  top: 0;  right: 0;  bottom: 0;  left: 0;  z-index: 998;  width: 100%;  height: 100%;  _padding: 0 20px 0 0;  background: #f6f4f5;  display: none; } .showLoad {  position: fixed;  top: 0;  left: 50%;  z-index: 9999;  opacity: 0;  filter: alpha(opacity=0);  margin-left: -80px; } *html, *html body {  background-image: url(about:blank);  background-attachment: fixed; } *html .showLoad, *html .cover {  position: absolute;  top: expression(eval(document.documentElement.scrollTop)); } #ajaxLoad {  border: 1px solid #8CBEDA;  font-size: 12px;  font-weight: bold; } #ajaxLoad div.loadAll {  width: 180px;  height: 50px;  line-height: 50px;  border: 2px solid #D6E7F2;  background: #fff; } #ajaxLoad img {  margin: 10px 15px;  float: left;  display: inline; } </style> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript"> $(function () {  var hei = $(document).height();  $(".cover").css({ "height": hei });  $(".action").click(function () {  startWaiting();  setTimeout(function () {   endWaiting();  }, 3000);  }); }); //開始加載 function startWaiting() {  $(".cover").css({ 'display': 'block', 'opacity': '0.8' });  $(".showLoad").stop(true).animate({ 'margin-top': '300px', 'opacity': '1' }, 200); } //結束加載 function endWaiting() {  $(".showLoad").stop(true).animate({ 'margin-top': '250px', 'opacity': '0' }, 400);  $(".cover").css({ 'display': 'none', 'opacity': '0' }); } </script></head><body> <div class="loading"> <a class="action" href="javascript:void(0);" rel="external nofollow" >點擊加載特效</a></div> <div class="cover"> </div> <div id="ajaxLoad" class="showLoad"> <div class="loadAll">  <img src="image/waiting.gif">加載中,請稍候...</div> </div></body></html>

以上就是本文的全部內容,希望本文的內容對大家的學習或者工作能帶來一定的幫助,同時也希望多多支持武林網!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 隆回县| 永仁县| 蓬莱市| 巴南区| 山西省| 沈丘县| 杂多县| 余庆县| 揭阳市| 库伦旗| 南溪县| 永仁县| 芜湖县| 临漳县| 桦甸市| 东宁县| 平南县| 临朐县| 绥江县| 石台县| 奉节县| 平武县| 尼玛县| 六枝特区| 石城县| 芒康县| 保山市| 石门县| 闸北区| 昌乐县| 井陉县| 邵阳县| 泾川县| 高尔夫| 额敏县| 平阴县| 色达县| 肇源县| 边坝县| 屏山县| 贵溪市|