Last active
September 29, 2016 21:13
-
-
Save bekharsky/6bf3f98ffc5643706127e0a4c4727d5b to your computer and use it in GitHub Desktop.
Position icons in the staggered order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@step: @icon-size + 12 / 1366 * 100vw; | |
@t: @icon-size * 0.35; | |
@l: -@icon-size; | |
@d: 5ms; | |
@from: 0; | |
@to: 17; | |
@break: 6; | |
.loop(@index) when(@index =< @to) { | |
@i: @index + 1; | |
& when (not(mod(@i, 2) = 0)) { | |
&:nth-child(@{i}) { | |
top: @step * (@i - 1) / 2; | |
left: 0; | |
transition-delay: (@to - @index) * @d; | |
} | |
} | |
& when (mod(@i, 2) = 0) { | |
&:nth-child(@{i}) { | |
top: @t + @step * (@i - 2) / 2; | |
left: @l; | |
transition-delay: (@to - @index) * @d; | |
} | |
} | |
& when (@index <= @break) { | |
@c: @break - @index; | |
&:nth-child(@{i}):nth-last-child(@{c}) { | |
top: @step * @index; | |
left: 0; | |
transition-delay: (@break - @i) * @d; | |
} | |
} | |
.loop(@index + 1); | |
} | |
.full-page--icons > a { | |
.loop(@from); | |
&.moving { | |
top: 0 !important; | |
left: 0 !important; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is also a fairly good example of LESS loops and "if" conditions.