<div class="container slider-one-active">
<div class="steps">
<div class="step step-one">
<div class="liner"></div>
<span>Hello!</span>
</div>
<div class="step step-two">
<div class="liner"></div>
<span>Rating</span>
</div>
<div class="step step-three">
<div class="liner"></div>
<span>Conclusion</span>
</div>
</div>
<div class="line">
<div class="dot-move"></div>
<div class="dot zero"></div>
<div class="dot center"></div>
<div class="dot full"></div>
</div>
<div class="slider-ctr">
<div class="slider">
<form class="slider-form slider-one">
<h2>Step Form Design Experience</h2>
<label class="input">
<input type="text" class="name" placeholder="What's your name?">
</label>
<button class="first next">Next Step</button>
</form>
<form class="slider-form slider-two">
<h2>Are you happy with our service?</h2>
<div class="label-ctr">
<label class="radio">
<input type="radio" value="happy" name="condition">
<div class="emot happy">
<div class="mouth sad"></div>
</div>
</label>
<label class="radio">
<input type="radio" value="happy" name="condition">
<div class="emot happy">
<div class="mouth smile"></div>
</div>
</label>
</div>
<button class="second next">Next Step</button>
</form>
<div class="slider-form slider-three">
<h2>Hello, <span class="yourname"></span></h2>
<h3>Thank you for your input!
</h3>
<a class="reset" href="https://codepen.io/balapa/pen/XbXVRg" target="_blank">Reset</a>
</div>
</div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
* {
font-size: 16px;
}
input:focus,
button:focus {
outline: none;
}
button:hover,
.reset:hover {
opacity: .8;
}
button:active,
.reset:active {
opacity: .5;
}
.container {
width: 400px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.steps {
margin-bottom: 10px;
position: relative;
height: 25px;
}
.steps > div {
position: absolute;
top: 0;
-webkit-transform: translate(-50%);
-ms-transform: translate(-50%);
transform: translate(-50%);
height: 25px;
padding: 0 5px;;
display: inline-block;
width: 80px;
text-align: center;
-webkit-transition: .3s all ease;
transition: .3s all ease;
}
.steps > div > span {
line-height: 25px;
height: 25px;
margin: 0;
color: #777;
font-family: 'Roboto', sans-serif;
font-size: .9rem;
font-weight: 300;
}
.steps > div > .liner {
position: absolute;
height: 2px;
width: 0%;
left: 0;
top: 50%;
margin-top: -1px;
background: #999;
-webkit-transition: .3s all ease;
transition: .3s all ease;
}
.step-one {
left: 0;
}
.step-two {
left: 50%;
clip: rect(0, 0px, 25px, 0px);
}
.step-three {
left: 100%;
clip: rect(0, 0px, 25px, 0px);
}
.line {
width: 100%;
height: 5px;
background: #ddd;
position: relative;
border-radius: 10px;
overflow: visible;
margin-bottom: 50px;
}
.line .dot-move {
position: absolute;
top: 50%;
left: 0%;
width: 15px;
height: 15px;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background: #ddd;
border-radius: 50%;
-webkit-transition: .3s all ease;
transition: .3s all ease;
}
.line .dot {
position: absolute;
top: 50%;
width: 15px;
height: 15px;
left: 0;
background: #ddd;
border-radius: 50%;
-webkit-transition: .3s all ease;
transition: .3s all ease;
-webkit-transform: translate(-50%, -50%) scale(.5);
-ms-transform: translate(-50%, -50%) scale(.5);
transform: translate(-50%, -50%) scale(.5);
}
.line .dot.zero {
left: 0%;
background: #bbb;
}
.container.slider-one-active .dot.zero {
background: #5892fc;
}
.line .dot.center {
left: 50%;
background: #bbb
}
.line .dot.full {
left: 100%;
background: #bbb
}
.slider-ctr {
width: 100%;
overflow: hidden;
}
.slider {
overflow: hidden;
width: 1200px;
-webkit-transition: .3s all ease;
transition: .3s all ease;
-webkit-transform: translate(0px) scale(1);
-ms-transform: translate(0px) scale(1);
transform: translate(0px) scale(1);
}
.container.slider-one-active .slider-two,
.container.slider-one-active .slider-three {
-webkit-transform: scale(.5);
-ms-transform: scale(.5);
transform: scale(.5);
}
.container.slider-two-active .slider-one,
.container.slider-two-active .slider-three {
-webkit-transform: scale(.5);
-ms-transform: scale(.5);
transform: scale(.5);
}
.container.slider-three-active .slider-one,
.container.slider-three-active .slider-two {
-webkit-transform: scale(.5);
-ms-transform: scale(.5);
transform: scale(.5);
}
.slider-one,
.slider-two,
.slider-three {
-webkit-transition: .3s all ease;
transition: .3s all ease;
}
.slider-form {
float: left;
width: 400px;
text-align: center;
}
.slider-form h2 {
font-size: 1.5rem;
font-family: 'Roboto', sans-serif;
font-weight: 300;
margin-bottom: 50px;
color: #999;
position: relative;
}
.slider-form h2 .yourname {
font-weight: 400;
}
.slider-form h3 {
font-size: 1.5rem;
font-family: 'Roboto', sans-serif;
font-weight: 300;
margin-bottom: 50px;
line-height: 1.5;
color: #999;
position: relative;
}
.slider-form h3 .balapa {
font-family: 'Pacifico', sans-serif;
display: inline-block;
color: #5892fc;
text-decoration: none
}
.slider-form [type="text"] {
width: 100%;
box-sizing: border-box;
padding: 15px 20px;
background: #fafafa;
border: 1px solid transparent;
color: #777;
border-radius: 50px;
margin-bottom: 50px;
font-size: 1rem;
font-family: 'Roboto', sans-serif;
position: relative;
z-index: 99;
}
.slider-form [type="text"]:focus {
background: #fcfcfc;
border: 1px solid #ddd;
}
.slider-form button,
.reset {
display: inline-block;
text-decoration: none;
background: #5892fc;
border: none;
color: white;
padding: 10px 25px;
font-size: 1rem;
border-radius: 3px;
cursor: pointer;
font-family: 'Roboto', sans-serif;
font-weight: 300;
position: relative;
}
/* emot */
.label-ctr {
margin-bottom: 50px;
}
label.radio {
height: 55px;
width: 55px;
display: inline-block;
margin: 0 10px;
background: transparent;
position: relative;
border-radius: 50%;
cursor: pointer
}
label.radio input {
visibility: hidden
}
label.radio input:checked + .emot {
-webkit-transform: scale(1.25);
-ms-transform: scale(1.25);
transform: scale(1.25);
}
label.radio input:checked + .emot,
label.radio input:checked + .emot .mouth {
border-color: #5892fc;
}
label.radio input:checked + .emot:before,
label.radio input:checked + .emot:after {
background: #5892fc;
}
label.radio .emot {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fafafa;
border-radius: 50%;
border: 2px solid #ddd;
-webkit-transition: .3s all ease;
transition: .3s all ease;
}
label.radio .emot:before {
content: "";
position: absolute;
top: 15px;
left: 15px;
width: 5px;
height: 10px;
background: #ddd;
}
label.radio .emot:after {
content: "";
position: absolute;
top: 15px;
right: 15px;
width: 5px;
height: 10px;
background: #ddd;
}
label.radio .emot .mouth {
position: absolute;
bottom: 10px;
right: 15px;
left: 15px;
height: 15px;
border-radius: 50%;
border: 3px solid #ddd;
background: transparent;
clip: rect(0, 35px, 10px, 0);
}
label.radio .emot .mouth.smile {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
label.radio .emot .mouth.sad {
-webkit-transform: translateY(50%);
-ms-transform: translateY(50%);
transform: translateY(50%);
}
/* center */
.container.center .line .dot-move {
left: 50%;
-webkit-animation: .3s anim 1;
}
.container.center .line .dot.center {
background: #5892fc;
}
.container.center .slider {
-webkit-transform: translate(-400px);
-ms-transform: translate(-400px);
transform: translate(-400px);
}
.container.center .step-two {
clip: rect(0, 100px, 25px, 0px);
}
.container.center .step-one .liner {
width: 100%;
}
/* full */
.container.full .line .dot-move {
left: 100%;
-webkit-animation: .3s anim 1;
}
.container.full .line .dot.full {
background: #5892fc;
}
.container.full .slider {
-webkit-transform: translate(-800px);
-ms-transform: translate(-800px);
transform: translate(-800px);
}
.container.full .step-two,
.container.full .step-three {
clip: rect(0, 100px, 25px, 0px);
}
.container.full .step-one .liner,
.container.full .step-two .liner {
width: 100%;
}
var $firstButton = $(".first"),
$secondButton = $(".second"),
$input = $("input"),
$name = $(".name"),
$more = $(".more"),
$yourname = $(".yourname"),
$reset = $(".reset"),
$ctr = $(".container");
$firstButton.on("click", function(e){
$(this).text("Saving...").delay(900).queue(function(){
$ctr.addClass("center slider-two-active").removeClass("full slider-one-active");
});
e.preventDefault();
});
$secondButton.on("click", function(e){
$(this).text("Saving...").delay(900).queue(function(){
$ctr.addClass("full slider-three-active").removeClass("center slider-two-active slider-one-active");
$name = $name.val();
if($name == "") {
$yourname.html("Anonymous!");
}
else { $yourname.html($name+"!"); }
});
e.preventDefault();
});
This Pen doesn't use any external CSS resources.