"Step Indicator "
Bootstrap 3.0.0 Snippet by muhittinbudak

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<body>
<link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap'>
<form>
<div class="steps">
<div class="steps__step" data-step="0">
<div class="steps__step-number">1</div>
<div class="steps__step-name">About You</div>
</div>
<div class="steps__connector"></div>
<div class="steps__step" data-step="1">
<div class="steps__step-number">2</div>
<div class="steps__step-name">About Book</div>
</div>
<div class="steps__connector"></div>
<div class="steps__step" data-step="2">
<div class="steps__step-number">3</div>
<div class="steps__step-name">Review</div>
</div>
<div class="steps__connector"></div>
<div class="steps__step" data-step="3">
<div class="steps__step-number">4</div>
<div class="steps__step-name">Signing</div>
</div>
<div class="steps__connector"></div>
<div class="steps__step" data-step="4">
<div class="steps__step-number">5</div>
<div class="steps__step-name">Contract</div>
</div>
</div>
<div class="btn-group">
<button class="btn" type="button" data-action="prev" disabled>Previous</button>
<button class="btn" type="button" data-action="next">Next</button>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
* {
border: 0;
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--hue: 223;
--bg: hsl(var(--hue),10%,90%);
--fg: hsl(var(--hue),10%,10%);
--primary: hsl(var(--hue),90%,30%);
--trans-dur: 0.3s;
--trans-timing: cubic-bezier(0.65,0,0.35,1);
font-size: calc(16px + (48 - 16) * (100vw - 280px) / (3840 - 280));
}
body,
button {
font: 1em/1.5 "DM Sans", sans-serif;
}
body {
background-color: var(--bg);
color: var(--fg);
display: flex;
height: 100vh;
}
form {
container: form/inline-size;
margin: auto;
padding: 1.5em;
width: 100%;
max-width: 36em;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict";
window.addEventListener("DOMContentLoaded", () => {
const steps = new StepIndicator(".steps");
});
class StepIndicator {
/**
* @param el CSS selector of the step indicator element
*/
constructor(el) {
/** Number of steps */
this.steps = 5;
this._step = 0;
this.el = document.querySelector(el);
document.addEventListener("click", this.clickAction.bind(this));
this.displayStep(this.step);
this.checkExtremes();
}
get step() {
return this._step;
}
set step(value) {
this.displayStep(value);
this._step = value;
this.checkExtremes();
}
/**
* @param e Click event
*/
clickAction(e) {
const button = e.target;
const actionName = button === null || button === void 0 ? void 0 : button.getAttribute("data-action");
if (actionName === "prev") {
this.prev();
}
else if (actionName === "next") {
this.next();
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: