Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
1
2
3
4
Prev
next
css
@import url('https://fonts.googleapis.com/css2?family=Muli&display=swap'); * { box-sizing: border-box; } :root{ --line-border-fill: #3498db; --line-border-empty: #e0e0e0; } body{ font-family:'Muli', sans-serif; margin: 0; display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; background-color: #1f1f1f; } .container{ text-align: center; } .progress-container{ position: relative; display: flex; align-items: center; justify-content: space-between; max-width: 100%; width: 320px; margin-bottom: 30px; } .progress-container::before{ content: ''; position: absolute; background-color: var(--line-border-empty); top: 50%; left: 0; height: 4px; width: 100%; z-index: -1; transform: translateY(-50%); } .progress{ position: absolute; background-color: var(--line-border-fill); top: 50%; left: 0; height: 4px; width: 0%; z-index: -1; transform: translateY(-50%); transition: .4s ease; } .circle{ background-color: #fff; display: flex; justify-content: center; align-items: center; border-radius: 50%; color: #999; width: 30px; border: 3px solid var(--line-border-empty); transition: .4s ease; } .circle.active{ border-color: var(--line-border-fill); } .btn{ background-color: var(--line-border-fill); color: #fff; border: 0; cursor: pointer; font-family: inherit; padding: 8px 30px; margin: 5px; font-size: 14px; border-radius: 5px; } .btn:active{ transform: scale(0.98); } .btn:focus{ outline: 0; } .btn:disabled{ background-color: var(--line-border-empty); cursor: not-allowed; }
JavaScript
const progress = document.getElementById('progress') const prev = document.getElementById('prev') const next = document.getElementById('next') const circles = document.querySelectorAll('.circle') let currentActive = 1 next.addEventListener('click', () => { currentActive++ if(currentActive > circles.length){ currentActive = circles.length } update() //console.log(currentActive) }) prev.addEventListener('click', () => { currentActive-- if(currentActive < 1){ currentActive = 1 } update() //console.log(currentActive) }) function update(){ circles.forEach((circle, idx) => { if (idx < currentActive) { circle.classList.add('active') }else{ circle.classList.remove('active') } }) const actives = document.querySelectorAll('.active') progress.style.width = (actives.length - 1) / (circles.length - 1) * 100 + '%' if(currentActive ===1){ prev.disabled = true }else if (currentActive === circles.length) { next.disabled = true }else{ prev.disabled = false next.disabled = false } }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>进度步骤-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号