Skip to content

Instantly share code, notes, and snippets.

@sixertoy
Last active February 27, 2016 08:31
Show Gist options
  • Save sixertoy/f9b896c1159da3040f34 to your computer and use it in GitHub Desktop.
Save sixertoy/f9b896c1159da3040f34 to your computer and use it in GitHub Desktop.
Less-curious Loop For Each Example
.socials {
@names: facebook, instagram, rss, twitter;
.icon{
width: 24px;
height: 24px;
display:block;
overflow: hidden;
text-indent: -9999px;
background: url(../images/socials_icons_24x24.png) no-repeat 0 0 transparent;
.for(1, length(@names)); .-each(@i) {
@name: extract(@names, @i);
&-@{name} {
background-position: ((@i - 1) * -24px) 0;
}
}
}
}
@count:100;
.loop (@index, @step) when (@index > -1) {
.span@{index} {
opacity: (@index / 100);
}
@tmp:(@index - @step);
.loop(@tmp, @step);
}
.loop (@count, 25);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment