jquery实现页面等待加载“转圈圈”效果

jquery实现页面等待加载“转圈圈”效果

A little of BB:看了不少前端框架,寻思着自己diy封一个加载转圈圈的效果,以后在项目上节省时间(“懒”就一个字),话不多说,ctrl v出来见真章
1.js全部源码,loading.js

/***  数据加载动态圈风格* @param property 参数对象*  property 参数对象详细属性设置↓* type (start,stop) 加载或停止转圈* content 加载提示内容* shadowColor 背景阴影颜色-建议使用带透明的颜色* loadingBoxColor  加载背景色* loadingPointColor  转圈点颜色* loadingContentColor  加载提示内容字体颜色*/function initLoading(property) {$("body .loading-box-shadow-omg").remove();//清除加载图层if(property.type=="stop"){return;}var nodeHtml = '<div class="loading-box-shadow-omg"><div class="loading-box">';nodeHtml += '<div class="loading-circle"></div><div class="loading-content"></div></div></div>';$("body").append(nodeHtml);//加载布局元素var html = '<div style="top: 5%;left: 53%;width: 5px;height: 5px;"></div>';html += '<div style="top: 11%;left: 30%;width: 7px; height: 7px;"></div>';html += '<div style="top: 26%;left: 12%;width: 9px;height: 9px;"></div>';html += '<div style="top: 48%;left: 7%;width: 9px;height: 9px;"></div>';html += '<div style="top: 70%;left: 15%;width: 9px;height: 9px;"></div>';html += '<div style="top: 85%;left: 33%;width: 9px;height: 9px;"></div>';html += '<div style="top: 89%;left: 54%;width: 9px;height: 9px;"></div>';html += '<div style="top: 80%;left: 75%;width: 9px;height: 9px;"></div>';$("body .loading-circle").html(html);var content = "正在加载中...";//提示内容if(property.content){content = property.content;}$("body .loading-content").text(content);var shadowColor = "#211f1f5c";//阴影颜色if(property.shadowColor){shadowColor = property.shadowColor;$('body .loading-box-shadow-omg').css("background-color",shadowColor);}var loadingBoxColor = "white";//加载框背景色if(property.loadingBoxColor){loadingBoxColor = property.loadingBoxColor;$('body .loading-box-shadow-omg .loading-box').css("background-color",loadingBoxColor);}var loadingPointColor = "#292961";//动态点颜色if(property.loadingPointColor){loadingPointColor = property.loadingPointColor;$('body .loading-box-shadow-omg .loading-circle>div').css("background-color",loadingPointColor);}var loadingContentColor = "rebeccapurple";//提示内容颜色if(property.loadingContentColor){loadingContentColor = property.loadingContentColor;$('body .loading-box-shadow-omg .loading-content').css("color",loadingContentColor);}};initLoading({type:"start",content:"loading...",// shadowColor:"grey",// loadingBoxColor:"yellow",// loadingPointColor:"green",// loadingContentColor:"red"
});

2.css全部源码,loading.css(ps:gif图都不用找UI了,嘿嘿,不过肯定没UI的精美)

html body{margin: 0;padding: 0;
}/*动态加载圈-loading-start*/
body .loading-box-shadow-omg{width: -webkit-fill-available;height: -webkit-fill-available;background-color: #211f1f5c;position: absolute;top: 0;z-index: 9999999;
}.hidden{display: none!important;
}body .loading-box-shadow-omg .loading-box{background-color: white;border-radius: 5px;position: absolute;top: 20%;left: 40%;width: 20%;height: 25%;
}body .loading-box-shadow-omg .loading-box .loading-circle{width: 80px;height: 80px;background-color: transparent;position: absolute;left: 35%;top: 10%;animation: init-circle 1s linear infinite;
}body .loading-box-shadow-omg .loading-box .loading-content{position: absolute;bottom: 5%;font-weight: bold;color: rebeccapurple;width: 100%;text-align: center;
}body .loading-box-shadow-omg .loading-box .loading-circle>div{background-color: #292961;border-radius: 20px;position: absolute;
}@keyframes init-circle {from{transform: rotate(360deg);}to{transform: rotate(0deg);}
}
/*动态加载圈-loading-stop*/

3.html全部源码,loading.html

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>hello</title><link rel="stylesheet" href="loading.css">
</head>
<body>
</script>
</body>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="loading.js"></script>
</html>

3.效果图
在这里插入图片描述

4.调用initLoading方法时,可以自定义阴影遮盖颜色,转圈圈颜色等设置,属性设置方面,见js注释

initLoading({type:"start",content:"loading...",// shadowColor:"grey",// loadingBoxColor:"yellow",// loadingPointColor:"green",// loadingContentColor:"red"
});

5.源码下载:https://download.csdn.net/download/qq_40000351/11972437

6.我没秃,但我始终有一颗变强的心!
7.转载需注明出处,盗版必究。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/18624.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

访问页面转圈圈,怎么分析

测试中碰到响应时间慢、TPS上不去、访问页面转圈圈&#xff0c;该怎么分析&#xff1f;把从发请求到返回请求整个架构图画出来&#xff0c;分析整个链路中哪些地方可能导致这些问题。 通常碰到这些问题&#xff0c;都是由以下11种情况导致&#xff0c;下面我们挨个分析&#x…

docker desktop 点击setting 一直转圈圈

docker desktop&#xff0c; 右键点击setting &#xff0c;界面打开后一直转圈圈问题 1、打开运行&#xff0c;在空框中输入powershell并点击确定&#xff1a; 2、在PowerShell中输入&#xff1a; docker images报错 error during connect: In the default daemon configurati…

网络卡打开网页在转圈圈怎么解决?

出现这种问题&#xff0c;先去网络和共享中心看一下以太网的详细信息&#xff0c;看有没有网络&#xff08;操作如下&#xff09; 右键点击打开网络和Internet设置&#xff0c;点击以太网 右侧相关设置点击网络和共享中心 点击以太网 通过这个界面判断有没有网络先 ipv4连接有…

win10电脑开机鼠标一直在转圈圈

概述&#xff1a; win10电脑开机鼠标一直在转圈圈&#xff0c;还等很久才能反应过来这谁顶的住呀&#xff01;&#xff01;&#xff01; 办法一&#xff1a; 控制面板——》用户账户——》更改用户账户控制设置 设置为从不通知&#xff0c;重启电脑。 方法二&#xff1a; win…

已解决 文件右键转圈圈,电脑卡死

怀着激动的心&#xff0c;颤抖的手&#xff0c;在深夜&#xff0c;将我成功的 “”经验“ 分享给大家&#xff0c;希望能帮助和我一样经历的人儿。。。 起因&#xff1a;360清理系统 症状&#xff1a;文件/文件夹右键转圈圈&#xff0c;电脑卡死 经过&#xff1a;在网上查找…

右键文件夹一直转圈圈怎么办

一、下载并安装Windows 10 Manager 官方下载地址&#xff1a;https://www.yamicsoft.com/cn/windows10manager/product.html 或到我的蓝奏云上下载&#xff1a; https://wwr.lanzoui.com/i5NSdr4umad 密码:hz16 二、打开软件&#xff0c;选择自定义菜单&#xff0c;再点击右…

魅族开机卡flyme转圈圈

魅族开机卡flyme转圈圈可能是系统原因&#xff0c;可以尝试恢复出厂设置&#xff0c;操作步骤如下&#xff1a; 1、长按音量的上键和电源键 长按手机上的音量的上键和电源键。 2、恢复出厂设置 等待进入emui界面&#xff0c;点击恢复出厂设置的选项。 3、重启手机 重新启动…

win10鼠标右键文件夹一直转圈圈

问题描述&#xff1a;今天想创建一个文件夹&#xff0c;往文件夹里存点东西&#xff0c;准备鼠标右键文件夹给文件夹重命名一下&#xff0c;结果一点鼠标右键&#xff0c;就一直转圈圈&#xff0c;过了一会显示window未响应。结束进程后&#xff0c;我先尝试了在桌面空白处点击…

windows10右键文件夹菜单资源管理器卡死(转圈圈)

问题描述 在今年的某月某日的某一刻&#xff0c;我突然发现我右键文件夹后&#xff0c;鼠标一直转圈圈&#xff0c;然后就啥都做不了了&#xff0c;然后鼠标一直点一直点&#xff0c;直到把资源管理器点了卡死关闭&#xff0c;才能操作其他的&#xff0c;经过一番折腾发现&…

微软账户登录一直转圈圈怎么办?

微软账户登录一直转圈圈怎么办&#xff1f; 很多时候会出先这样的情况&#xff0c;话不多说&#xff0c;直接来解决办法 第一种 1、在登录Windows10系统的时候&#xff0c;如果登录异常&#xff0c;则不要使用Administrator超级用户登录系统&#xff0c;而是使用新建的帐户登…

loading--加载转圈圈效果

vue–loading–加载转圈圈效果 哈哈哈哈哈&#xff0c;固定的就很糟糕&#xff0c;使用的时候需要自己改&#xff0c;还好我自己不需要 分为&#xff1a;large&#xff08;大&#xff09; medium&#xff08;中&#xff09; small&#xff08;小&#xff09;&#xff1b;由于我…

右击文件夹一直转圈圈卡死

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)AppXManifest.xml"} 打开后&#xff0c;输入上面的代码&#xff0c;回车执行便可解决该问题。

文件夹右击一直转圈圈

“百度网盘问题”。在火绒&#xff08;其他安全管家&#xff0c;安全卫士也可以&#xff09;“右键管理菜单”里把“百度网盘”的勾取消了就可以 第一步 第二步 第三步

从Chat-GPT了解技术概念及医疗领域应用

导读 作者来自互联网医疗服务团队&#xff0c;团队一直致力于在医疗行业中探索和应用前沿科技。目前主要在医学对话&#xff0c;远程医疗、医学影像诊断等方面进行探索和尝试&#xff0c;相信可以为医生和患者带来更好的医疗服务。 01 前言 最近OpenAI在官网上宣告了多模态大模…

ChatGPT训练三阶段与RLHF的威力

在探讨“ChatGPT为什么能够捕捉我们的想象力”的文献中&#xff0c;一般可以看到两种说法&#xff1a;规模化为其提供更多的数据和计算资源&#xff1b;提示界面转向更自然聊天界面的用户体验。 然而&#xff0c;人们常忽略了这样一个事实&#xff0c;即&#xff1a;创造像Chat…

HTTPS - ChatGPT解答

1 HTTP 和 HTTPS HTTP和HTTPS都是用于传输Web数据的协议&#xff0c;但它们之间有几个重要的区别&#xff1a; &#xff08;1&#xff09;安全性&#xff1a;HTTP是明文传输协议&#xff0c;数据在传输过程中是不加密的&#xff0c;容易被黑客窃取或篡改。而HTTPS使用SSL/TLS…

【ChatGPT】ChatGPT统计富豪信息

参考视频&#xff1a;https://edu.csdn.net/learn/38346/613916 2023福布斯中国香港富豪榜前50名中&#xff0c;属于房地产行业的有多少人&#xff0c;占比是多少 相关链接:https://www.forbeschina.com/lists/1800 1.将数据从网站上粘贴到excel中&#xff0c;删除空行 2.问…

我用 ChatGPT 干的 18 件事!【人工智能中文站创始人:mydear麦田访谈】

新建了一个网站 https://ai.weoknow.com/ 每天给大家更新可用的国内可用chatGPT 你确定你可以使用ChatGPT吗&#xff1f; 今天我整理了18种ChatGPT的使用方法&#xff0c;让大家看看你可以使用哪些。 1.语法修正 2.文本翻译 3.语言转换 4.代码解释 5.修复代码错误 6.作为百科…

基于pytorch自己训练一个小型的chatgpt闲聊程序

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、GPT介绍1.无监督预训练2.有监督下游任务精调3.适配不同的下游任务 二、基于pytorch自己训练一个小型chatgpt1.数据集2. 模型3.方法介绍4.核心代码展示4.实现效果…

chatgpt赋能python:Python如何删查网易云的VIP音乐?

Python如何删查网易云的VIP音乐&#xff1f; 介绍 近年来&#xff0c;网易云音乐成为了国内最受欢迎的音乐平台之一&#xff0c;拥有海量的音乐资源&#xff0c;但其中部分高品质音乐需要付费成为VIP用户才能畅听。许多用户为了节省开支&#xff0c;想要了解如何在不付费情况…