fader's pips reworked: now using tricky gradient instead of 100x small elements

This commit is contained in:
jean-emmanuel 2016-03-24 00:50:36 +01:00
parent 3df3b18193
commit d0807097e8
3 changed files with 60 additions and 46 deletions

View file

@ -1,3 +1,18 @@
@mixin pips($direction: "to bottom") {
$color: var(--color-text-fade);
$gradient: $color, $color 1rem, transparent 1rem,transparent 1%;
@for $i from 1 through 100 {
$dump: ();
$dump: $color + ' '+ $i+'%, ' + $color +' calc('+$i+'% + 1rem),transparent calc('+$i+'% + 1rem),transparent '+($i+1)+'%';
$gradient: join($gradient, unquote($dump), comma);
}
background: linear-gradient(unquote($direction), $gradient);
}
.fader-container {
width:100rem;
min-height: 200rem;
@ -140,30 +155,29 @@
bottom:0;
left:50%;
z-index: 0;
width: 38rem;
margin-left: -19rem;
@include pips;
.pip {
height:1%;
width:38rem;
margin-left:-19rem;
background: linear-gradient(var(--color-text),transparent 1rem);
&.val {
position: relative;
width:44rem;
margin-left:-22rem;
span {
position: absolute;
width:30rem;
display: block;
text-align: center;
font-size:11rem;
line-height: 12rem;
left:44rem;
top:-5.5rem;
color:var(--color-text-fade);
&:last-child {
left:auto;
right:44rem;
}
background: linear-gradient(var(--color-text-fade), var(--color-text-fade) 1rem,transparent 1rem);
position: absolute;
width:44rem;
margin-left:-3rem;
span {
position: absolute;
width:30rem;
display: block;
text-align: center;
font-size:11rem;
line-height: 12rem;
left:44rem;
top:-5.5rem;
color:var(--color-text-fade);
&:last-child {
left:auto;
right:44rem;
}
}
}
@ -228,29 +242,25 @@
}
}
.pips {
top:14rem;left:0;
top:15rem;left:0;
right:0;
font-size: 0;
height:4rem;
width:100%;
margin:0;
@include pips('to right');
}
.pip {
width:1%;
display: inline-block;
height:4rem;
margin-bottom:5rem;
margin-left:0;
background: linear-gradient(90deg,var(--color-text),transparent 1rem );
&.val {
width:1%;
height:10rem;
margin-left:0;
margin-bottom:0;
background: linear-gradient(90deg,var(--color-text-fade),var(--color-text-fade) 1rem,transparent 1rem );
height:6rem;
margin: 0;
span {
top:15rem;
left:-15rem;
&:last-child {
display: none;
}
span {
top:15rem;
left:-15rem!important;
&:last-child {
right:auto;
}
}
}