Created
January 13, 2015 22:24
-
-
Save envoytravis/281a1837366e86419f69 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.2.19) | |
// Compass (v0.12.7) | |
// Sass List-Maps (v0.9.9) | |
// ---- | |
@import "sass-list-maps"; | |
@function is-list($value) { | |
@return if(length($value) > 1, true, false); | |
} | |
@mixin cascade($selectors, $amount:300, $reverse:false) { | |
$is-list: is-list($selectors); | |
$length: if($is-list, length($selectors), $selectors); | |
@for $i from 1 through $length { | |
$index: if($reverse, $length + 1 - $i, $i); | |
$delay: $i * $amount; | |
@if $is-list { | |
#{nth($selectors, $index)} { | |
transition-delay: $delay + ms; | |
} | |
} | |
@else { | |
&:nth-of-type(#{$index}) { | |
transition-delay: $delay + ms; | |
} | |
} | |
} | |
} | |
.block { | |
@include cascade((".foo", ".bar", ".baz"), $reverse:true); | |
@include cascade(3); | |
} |
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
.block .baz { | |
transition-delay: 300ms; | |
} | |
.block .bar { | |
transition-delay: 600ms; | |
} | |
.block .foo { | |
transition-delay: 900ms; | |
} | |
.block:nth-of-type(1) { | |
transition-delay: 300ms; | |
} | |
.block:nth-of-type(2) { | |
transition-delay: 600ms; | |
} | |
.block:nth-of-type(3) { | |
transition-delay: 900ms; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment