From 759ced9a4f0d448fd03a6f411e989453cf38a108 Mon Sep 17 00:00:00 2001 From: Some Web Media Date: Thu, 2 Jul 2015 15:24:45 +0200 Subject: [PATCH] updated docs for new transition mixin --- doc/includes/examples_global_rendered.html | 71 +++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/doc/includes/examples_global_rendered.html b/doc/includes/examples_global_rendered.html index d47c3e91d..452c929b2 100644 --- a/doc/includes/examples_global_rendered.html +++ b/doc/includes/examples_global_rendered.html @@ -72,9 +72,76 @@ $base-line-height: 150% !default; // We use this to add transitions to elements // $property - Default: all, Options: http://www.w3.org/TR/css3-transitions/#animatable-properties // $speed - Default: 300ms -// $ease - Default:ease-out, Options: http://css-tricks.com/almanac/properties/t/transition-timing-function/ +// $ease - Default: ease-out, Options: http://css-tricks.com/almanac/properties/t/transition-timing-function/ @mixin single-transition($property:all, $speed:300ms, $ease:ease-out) { - transition: $property $speed $ease; + @include transition($property, $speed, $ease); +} + +// @mixins +// +// We use this to add single or multiple transitions to elements +// $property - Default: all, Options: http://www.w3.org/TR/css3-transitions/#animatable-properties +// $speed - Default: 300ms +// $ease - Default: ease-out, Options: http://css-tricks.com/almanac/properties/t/transition-timing-function/ +// $delay - Default: null (0s) +@mixin transition($property:all, $speed:300ms, $ease:ease-out, $delay:null) { + $transition: none; + + @if length($property) > 1 { + + @each $transition_list in $property { + + @for $i from 1 through length($transition_list) { + + @if $i == 1 { + $_property: nth($transition_list, $i); + } + + @if length($transition_list) > 1 { + @if $i == 2 { + $_speed: nth($transition_list, $i); + } + } @else { + $_speed: $speed; + } + + @if length($transition_list) > 2 { + @if $i == 3 { + $_ease: nth($transition_list, $i); + } + } @else { + $_ease: $ease; + } + + @if length($transition_list) > 3 { + @if $i == 4 { + $_delay: nth($transition_list, $i); + } + } @else { + $_delay: $delay; + } + } + + @if $transition == none { + $transition: $_property $_speed $_ease $_delay; + } @else { + $transition: $transition, $_property $_speed $_ease $_delay; + } + } + } + @else { + + @each $prop in $property { + + @if $transition == none { + $transition: $prop $speed $ease $delay; + } @else { + $transition: $transition, $prop $speed $ease $delay; + } + } + } + + transition: $transition; } // @mixins -- 2.47.2