jQuery生成假加载动画效果
在使用PDFObject.js时,由于后台需要转换数据,在前台显示的时候,有很长一段时间显示空白页面,所以想到写一个假的加载动画
script片段:
<script type="text/javascript"> var bar = 0; var line = "||" ; var amount ="||" ; function count(){ bar= bar+2 ; amount =amount + line; $("#chart").val(amount); $("#percent").val(bar+"%"); if (bar<99){ //设置1.5秒循环一次 setTimeout("count()",150); }else{ $("#beforeSee").hide(); $("#pdfSee").show(); }; }; window.onload = function (){ PDFObject.embed("请求?code=${vdata.code}", "#pdfSee"); count(); }; </script>
body片段:
<body > <div align=center id="beforeSee" width="100%" height="100%"> <p><span class="red" style="font-size:50px;">拼命加载中,请稍后</span></p> <p> <input type="text" id="chart" name="chart" size="46" style="font-family:Arial; font-weight:bolder; color:gray;background-color:white; padding:0px; border-style:none;"> <br> <input type="text" id="percent" name="percent" size=46 style="font-family:Arial; color:gray; text-align:center; border-width:medium; border-style:none;"> <script type="text/javascript"> </script> </p> </div> <div align=center id="pdfSee" style="display:none" width="100%" height="100%"> <p><span class="red" style="font-size:50px;">控件丢失,请重新加载</span></p> </div> </body>
相关推荐
tztzyzyz 2020-07-05
87281248 2020-07-04
tztzyzyz 2020-05-31
81463166 2020-05-17
81463166 2020-05-16
donghongbz 2020-05-15
89510194 2020-05-15
donghongbz 2020-05-15
88284453 2020-05-09
GDYG 2020-05-04
88570299 2020-05-12
89510194 2020-05-07
tthappyer 2020-05-04
80437916 2020-05-03
牵手白首 2020-04-29
80437916 2020-04-25
89463661 2020-04-25
83510998 2020-04-21
89463661 2020-04-19