本文实例讲述了jquery实现加载进度条提示效果代码。分享给大家供大家参考。具体如下:
运行效果截图如下:
具体代码如下:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>进度条</title> <script type="text/javascript" src="/UploadFiles/2021-04-02/jquery.min.js">css样式:
body,div { padding: 0; margin: 0; } div.spinner { position: absolute; width: 160px; height: 160px; margin-left: 240px; margin-top: 350px; } div.loaderdot { position: absolute; width: 20px; height: 20px; border-radius: 50%; background-color: rgb(29, 140, 248); } 1 window.onload = function() {js代码:
var total = 16, angle = 3 * Math.PI, Radius = 80, html = ''; var spinnerL = parseInt($("div.spinner").css("margin-left")); var spinnerT = parseInt($("div.spinner").css("margin-top")); for (var i = 0; i < total; i++) { //对每个元素的位置和透明度进行初始化设置 var loaderL = Radius + Radius * Math.sin(angle) - 10; var loaderT = Radius + Radius * Math.cos(angle) - 10; html += "<div class='loaderdot' style='left:" + loaderL + "px;top:" + loaderT + "px; opacity:" + i / (total - 1) + "'></div>"; angle -= 2 * Math.PI / total; } $("div.spinner").empty().html(html); var lastLoaderdot = $("div.loaderdot").last(); timer = setInterval(function() { $("div.loaderdot").each(function() { var self = $(this); var prev = self.prev().get(0) "opacity"); self.animate({ opacity: opas }, 50); }); }, 60); 27}希望本文所述对大家学习jquery程序设计有所帮助。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“jquery实现加载进度条提示效果”评论...