You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
789 B
31 lines
789 B
// Foundation for Sites by ZURB |
|
// foundation.zurb.com |
|
// Licensed under MIT Open Source |
|
|
|
//// |
|
/// @group functions |
|
//// |
|
|
|
/// Returns the opposite direction of $dir |
|
/// |
|
/// @param {Keyword} $dir - Used direction between "top", "right", "bottom" and "left". |
|
/// @return {Keyword} Opposite direction of $dir |
|
@function direction-opposite( |
|
$dir |
|
) { |
|
$dirs: (top, right, bottom, left); |
|
$place: index($dirs, $dir); |
|
|
|
@if $place == null { |
|
@error 'direction-opposite: Invalid $dir parameter, expected a value from "#{$dirs}", found "#{$dir}".'; |
|
@return null; |
|
} |
|
|
|
// Calcul the opposite place in a circle, with a starting index of 1 |
|
$length: length($dirs); |
|
$demi: $length / 2; |
|
$opposite-place: (($place + $demi - 1) % $length) + 1; |
|
|
|
@return nth($dirs, $opposite-place); |
|
} |
|
|
|
|