Skip to content

Instantly share code, notes, and snippets.

@yuijim
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuijim/d8630adbfb40c46b3a58 to your computer and use it in GitHub Desktop.
Save yuijim/d8630adbfb40c46b3a58 to your computer and use it in GitHub Desktop.
Example of how to pass selectors to a mixin in LESS
.fade-toggle (@openSelector: ~'.open'; @inTransitionClassName: ~'transition-helper'; @openRight: 0; @zIndex: 1) {
.transition(opacity .25s ease-in-out);
position: absolute;
left: -9999em;
z-index: @zIndex;
opacity: 0;
@rls: {
left: 0;
right: @openRight;
};
&.@{inTransitionClassName} {
@rls();
}
.loop(@counter) when (@counter > 0) {
@selector: extract(@openSelector, @counter);
@{selector} > & {
@rls();
opacity: 1;
}
.loop((@counter - 1));
}
.loop(length(@openSelector));
}
.subnav {
.fade-toggle(~'li:hover', ~'.open'; @openRight: auto);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment