利用 spin.js 生成等待效果(js 等待效果)
发布时间 - 2026-01-11 02:02:30 点击率:次利用 js 生成一个界面友好的等待效果,使用 jquery 插件 spin.js,文章末尾有下载地址,下图是生成的效果截图,代码调用很简单。
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif; font-size: 12px;
}
#preview1 {
float: left; position: relative; background-color: #000; color: black; width: 220px; height: 220px; margin: 0 5px; border-radius: 20px;
}
#preview2 {
float: left; position: relative; background-color: #000; color: black; width: 220px; height: 220px; margin: 0 5px; border-radius: 20px;
}
</style>
<script src="jquery.min.js"></script>
<script src="spin.js"></script>
<script src="jquery.spin.js"></script>
<script type="text/javascript">
// 对样式 #preview1 进行配置
var opts1 =
{
lines : 12, // The number of lines to draw
length : 0, // The length of each line
width : 11, // The line thickness
radius : 40, // The radius of the inner circle
scale : 1.0, // Scales overall size of the spinner
corners : 0, // Roundness (0..1)
color : '#efefef', // #rgb or #rrggbb
opacity : 1 / 4, // Opacity of the lines
rotate : 0, // Rotation offset
direction : 1, // 1: clockwise, -1: counterclockwise
speed : 1, // Rounds per second
trail : 100, // Afterglow percentage
fps : 20, // Frames per second when using setTimeout()
zIndex : 2e9, // Use a high z-index by default
className : 'spinner', // CSS class to assign to the element
top : '50%', // center vertically
left : '50%', // center horizontally
shadow : false, // Whether to render a shadow
hwaccel : false, // Whether to use hardware acceleration (might be buggy)
position : 'absolute' // Element positioning
};
// 对样式 #preview2 进行配置
var opts2 =
{
lines : 18, // The number of lines to draw
length : 0, // The length of each line
width : 11, // The line thickness
radius : 40, // The radius of the inner circle
scale : 1.0, // Scales overall size of the spinner
corners : 0, // Roundness (0..1)
color : 'red', // #rgb or #rrggbb
opacity : 1 / 4, // Opacity of the lines
rotate : 0, // Rotation offset
direction : 1, // 1: clockwise, -1: counterclockwise
speed : 1, // Rounds per second
trail : 100, // Afterglow percentage
fps : 20, // Frames per second when using setTimeout()
zIndex : 2e9, // Use a high z-index by default
className : 'spinner', // CSS class to assign to the element
top : '50%', // center vertically
left : '50%', // center horizontally
shadow : false, // Whether to render a shadow
hwaccel : false, // Whether to use hardware acceleration (might be buggy)
position : 'absolute' // Element positioning
};
</script>
<title>Insert title here</title>
</head>
<body>
<div id="preview1" class="preview"></div>
<div id="preview2" class="preview"></div>
</body>
<script type="text/javascript">
$('#preview1').spin(opts1);
$('#preview2').spin(opts2);
</script>
</html>
插件下载地址
https://github.com/fgnass/spin.js/
http://spin.js.org/
以上所述是小编给大家介绍的利用 spin.js 生成等待效果(js 等待效果),希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
# spin.js等待效果
# js
# 等待效果
# 关于JavaScript中异步/等待的用法与理解
# JS设置手机验证码60s等待实现代码
# JS实现的自定义显示加载等待图片插件(loading.gif)
# 自己动手写的javascript前端等待控件
# JavaScript自定义等待wait函数实例分析
# 为JavaScript提供睡眠功能(sleep) 自编译JS引擎
# javascript 使用sleep函数的常见方法详解
# js中自定义方法实现停留几秒sleep
# javascript中不提供sleep功能如何实现这个功能
# 如何使JavaScript休眠或等待
# 下载地址
# 小编
# 给大家
# 很简单
# 所述
# 给我留言
# 有任何
# sans
# Arial
# family
# Helvetica
# serif
# px
# size
# Content
# Type
# meta
# equiv
相关栏目:
【
网站优化151355 】
【
网络推广146373 】
【
网络技术251813 】
【
AI营销90571 】
相关推荐:
JavaScript Ajax实现异步通信
网站制作大概要多少钱一个,做一个平台网站大概多少钱?
零服务器AI建站解决方案:快速部署与云端平台低成本实践
如何制作新型网站程序文件,新型止水鱼鳞网要拆除吗?
百度输入法ai组件怎么删除 百度输入法ai组件移除工具
如何在HTML表单中获取用户输入并结合JavaScript动态控制复利计算循环
C语言设计一个闪闪的圣诞树
Win11怎么更改系统语言为中文_Windows11安装语言包并设为显示语言
如何在建站之星网店版论坛获取技术支持?
ChatGPT常用指令模板大全 新手快速上手的万能Prompt合集
惠州网站建设制作推广,惠州市华视达文化传媒有限公司怎么样?
javascript中对象的定义、使用以及对象和原型链操作小结
HTML5空格和margin有啥区别_空格与外边距的使用场景【说明】
Laravel怎么在Blade中安全地输出原始HTML内容
如何打造高效商业网站?建站目的决定转化率
QQ浏览器网页版登录入口 个人中心在线进入
如何在橙子建站中快速调整背景颜色?
C++时间戳转换成日期时间的步骤和示例代码
javascript中数组(Array)对象和字符串(String)对象的常用方法总结
如何在不使用负向后查找的情况下匹配特定条件前的换行符
高端企业智能建站程序:SEO优化与响应式模板定制开发
怎么用AI帮你设计一套个性化的手机App图标?
Laravel Fortify是什么,和Jetstream有什么关系
如何在香港服务器上快速搭建免备案网站?
jquery插件bootstrapValidator表单验证详解
iOS发送验证码倒计时应用
Laravel策略(Policy)如何控制权限_Laravel Gates与Policies实现用户授权
如何在阿里云虚拟主机上快速搭建个人网站?
Laravel Octane如何提升性能_使用Laravel Octane加速你的应用
如何做网站制作流程,*游戏网站怎么搭建?
大同网页,大同瑞慈医院官网?
北京的网站制作公司有哪些,哪个视频网站最好?
Laravel如何使用Eloquent ORM进行数据库操作?(CRUD示例)
Laravel如何监控和管理失败的队列任务_Laravel失败任务处理与监控
Win11怎么开启自动HDR画质_Windows11显示设置HDR选项
Laravel如何构建RESTful API_Laravel标准化API接口开发指南
Laravel如何使用Spatie Media Library_Laravel图片上传管理与缩略图生成【步骤】
java获取注册ip实例
java ZXing生成二维码及条码实例分享
Windows驱动无法加载错误解决方法_驱动签名验证失败处理步骤
高性能网站服务器部署指南:稳定运行与安全配置优化方案
厦门模型网站设计制作公司,厦门航空飞机模型掉色怎么办?
如何用花生壳三步快速搭建专属网站?
jQuery 常见小例汇总
什么是JavaScript解构赋值_解构赋值有哪些实用技巧
JavaScript 输出显示内容(document.write、alert、innerHTML、console.log)
Laravel怎么进行浏览器测试_Laravel Dusk自动化浏览器测试入门
,南京靠谱的征婚网站?
JavaScript如何实现类型判断_typeof和instanceof有什么区别
Laravel如何发送系统通知?(Notification渠道示例)

