我有这个加载栏。当您添加active到时div class="step",它会增加进度。如何添加下一个和上一个按钮,根据您所在的步骤激活该按钮。
请帮忙!
$(document).ready(function() {
$('.step').each(function(index, element) {
// element == this
$(element).not('.active').addClass('done');
$('.done').html('<i class="icon-ok"></i>');
if ($(this).is('.active')) {
return false;
}
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen - loadingbar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body>
<!-- partial:index.partial.html -->
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<div id="steps">
<div class="step active" data-desc="Listing information"><i class="far fa-hand-pointer"></i></div>
<div class="step" data-desc="Photos & Details"><i class="fas fa-mortar-pestle"></i></div>
<div class="step" data-desc="Review & Post"><i class="fas fa-shipping-fast"></i></div>
<div class="step" data-desc="Your order"><i class="fas fa-shopping-cart"></i></div>
</div>
<!--
Try adding the active class to another 'step'
to see what's going on :)
-->
<!-- partial -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="./script.js"></script>
</body>
</html>
慕雪6442864
相关分类