在使用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>
以上所述是小編給大家介紹的jQuery生成假加載動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!
新聞熱點
疑難解答