PrahaSobe Signature Counter

In this example below you will see how to do a PrahaSobe Signature Counter with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by kubasanitrak, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright kubasanitrak ©
  • HTML
  • CSS
  • JavaScript
    <div class="counter-section"> 
<div class="count-container">
	<div class="count-label achieved">label achieved </div>
	<div class="count-label to-go">label to go</div>
	<div class="count-total">
		<div class="count-achieved"></div>
	</div>
</div>
	
</div>

/*Downloaded from https://www.codeseek.co/kubasanitrak/prahasobe-signature-counter-xzGboz */
    *, *::before, *::after {margin: 0; padding: 0; }
html {box-sizing: border-box} *, *::before, *::after {box-sizing: inherit}


@mixin bgc-offset($n, $color) { @for $i from 1 through $n { &:nth-child(#{$i}) { background-color: darken($color, 0% + ($i * 2)); } } } 
@mixin mq($point) {@if $point == mq-XL {@media screen and (min-width: 90.1rem) { @content; } } @else if $point == mq-L-UP {@media screen and (min-width: 48.1rem)  { @content; } } @else if $point == mq-M-UP {@media screen and (min-width: 40.1rem)  { @content; } } @else if $point == mq-S {@media screen and (max-width: 40rem)  { @content; } } @else if $point == mq-land {@media screen and (orientation: landscape)  { @content; } } @else if $point == mq-portr {@media screen and (orientation: portrait)  { @content; } } }

$carousel-bgc-C: #fee000;
$car-item-pad: 1rem 0;
$count-bar-H: 15px;
$repeat: 1;
$delay: 0.5s;

body {
	width: 100%;
	height: 100%;
	font-family: sans-serif;
}
.counter-section {
	margin: 20px auto;
	width: 100%;
	background-color: $carousel-bgc-C;
	overflow-y: hidden;
	padding: 2rem;
}
.count-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
}
.count-label {
	color: #fff;
	font-size: 0.875rem; 
	margin-bottom: 0.5em;
	transition: opacity;
	opacity: 0;
	animation: FADE-IN 0.5s 1.75s $repeat alternate ease-in-out forwards;
}
.achieved {
	color: #000;
	animation-delay: 1.5s;
}
.to-go {
	
}
.count-total {
	position: relative;
	width: 100%;
	height: $count-bar-H;
	background-color: #fff;
	transition: transform;
	transform: scale(1, 0);
	animation: GROW 1s $delay $repeat alternate ease-out forwards;
}
.count-achieved {
	position: absolute;
	width: 51%;
	height: $count-bar-H;
	transform: scale(0, 1);
	transition: transform;
	background-color: #000;
	transform-origin: center left;
	
	animation: TOGO 0.75s $delay $repeat alternate ease-in-out forwards;
	
	
	// animation-name: TOGO;
	// animation-duration: 1s; /* or: Xms */
	// animation-iteration-count: 1;
	// animation-direction: alternate; /* or: normal */
	// animation-direction: normal;
	// animation-timing-function: ease-out; /* or: ease, ease-in, ease-in-out, linear, cubic-bezier(x1, y1, x2, y2) */
	// animation-fill-mode: forwards; /* or: backwards, both, none */
	// animation-delay: 2s; /* or: Xms */
}
// Labely stejným textem, jednou černý, jednou bílý
// CSS3 keyframe animace - bez opakování, první frame jako výchozí stav
@keyframes TOGO {
	0% {
		transform: scale(0, 1);
	}
	100% {
		transform: scale(1, 1);
	}
}
@keyframes GROW {
	0% {
		transform: scale(1, 0);
	}
	70% {
		transform: scale(1, 0.2);
	}
	100% {
		transform: scale(1, 1);
	}
}
@keyframes FADE-IN {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}
// Na :hover subtilní posun o 1~2% a změna čísla v labelech


/*Downloaded from https://www.codeseek.co/kubasanitrak/prahasobe-signature-counter-xzGboz */
    

Comments