@include css-triangle($accordionmenu-arrow-size, $accordionmenu-arrow-color, down);
position: absolute;
top: 50%;
- margin-top: -1 * ($accordionmenu-arrow-size / 2);
+ margin-top: -1 * ($accordionmenu-arrow-size * 0.5);
#{$global-right}: 1rem;
}
}
&:first-child:nth-last-child(#{$i}) {
&, &:first-child:nth-last-child(#{$i}) ~ #{$selector} {
display: inline-block;
- width: calc(#{percentage(1 / $i)} - #{$spacing});
+ width: calc(#{percentage(divide(1, $i))} - #{$spacing});
margin-#{$global-right}: $spacing;
&:last-child {
@include css-triangle($dropdownmenu-arrow-size, $dropdownmenu-arrow-color, down);
#{$global-right}: 5px;
#{$global-left}: auto;
- margin-top: -1 * ($dropdownmenu-arrow-size / 2);
+ margin-top: -1 * ($dropdownmenu-arrow-size * 0.5);
}
}
}
/// Default color for header background.
/// @type Color
-$table-head-background: smart-scale($table-background, $table-color-scale / 2) !default;
+$table-head-background: smart-scale($table-background, $table-color-scale * 0.5) !default;
/// Default color of header rows on hover.
/// @type List
margin: 0 0 $form-spacing;
line-height: $global-lineheight;
- padding: ($form-spacing / 2 + rem-calc($input-border-width)) 0;
+ padding: ($form-spacing * 0.5 + rem-calc($input-border-width)) 0;
}
@mixin foundation-form-label {
@mixin foundation-range-input {
input[type='range'] { // sass-lint:disable-line no-qualifying-elements
- $margin: ($slider-handle-height - $slider-height) / 2;
+ $margin: ($slider-handle-height - $slider-height) * 0.5;
display: block;
width: 100%;
/// Padding of text inputs.
/// @type Color
-$input-padding: $form-spacing / 2 !default;
+$input-padding: $form-spacing * 0.5 !default;
/// Box shadow inside text inputs when not focused.
/// @type Shadow
flex-wrap: wrap;
> #{$selector} {
- $pct: percentage(1/$n);
+ $pct: percentage(divide(1, $n));
flex: 0 0 $pct;
max-width: $pct;
$gutters: $grid-column-gutter
) {
@include -zf-breakpoint-value($gutter, $gutters) {
- $padding: rem-calc($-zf-bp-value) / 2;
+ $padding: rem-calc($-zf-bp-value) * 0.5;
padding-right: $padding;
padding-left: $padding;
) {
& > #{$selector} {
float: $global-left;
- width: percentage(1/$n);
+ width: percentage(divide(1, $n));
// If a $gutter value is passed
@if($gutter) {
// Gutters
@if type-of($gutter) == 'map' {
@each $breakpoint, $value in $gutter {
- $padding: rem-calc($value) / 2;
+ $padding: rem-calc($value) * 0.5;
@include breakpoint($breakpoint) {
padding-right: $padding;
}
}
@else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
- $padding: rem-calc($gutter) / 2;
+ $padding: rem-calc($gutter) * 0.5;
padding-right: $padding;
padding-left: $padding;
}
@for $i from 1 to $n {
@if $i == 1 {
&:nth-child(#{$n}n+1):last-child {
- margin-left: (100 - 100/$n * $i) / 2 * 1%;
+ margin-left: (100 - divide(100, $n) * $i) * 0.5 * 1%;
}
}
@else {
&:nth-child(#{$n}n+1):nth-last-child(#{$i}) {
- margin-left: (100 - 100/$n * $i) / 2 * 1%;
+ margin-left: (100 - divide(100, $n) * $i) * 0.5 * 1%;
}
}
}
// Push/pull
@else if type-of($position) == 'number' {
- $offset: percentage($position / $grid-column-count);
+ $offset: percentage(divide($position, $grid-column-count));
position: relative;
#{$global-left}: $offset;
/// @param {Number|Map} $gutters [$grid-column-gutter] - Gutter map or single value to use when inverting margins. Responsive gutter settings by default.
@mixin grid-row-nest($gutters: $grid-column-gutter) {
@include -zf-each-breakpoint {
- $margin: rem-calc(-zf-get-bp-val($gutters, $-zf-size)) / 2 * -1;
+ $margin: rem-calc(-zf-get-bp-val($gutters, $-zf-size)) * 0.5 * -1;
margin-right: $margin;
margin-left: $margin;
$input-background-disabled: $light-gray;
$input-border: 1px solid $medium-gray;
$input-border-focus: 1px solid $dark-gray;
-$input-padding: $form-spacing / 2;
+$input-padding: $form-spacing * 0.5;
$input-shadow: inset 0 1px 2px rgba($black, 0.1);
$input-shadow-focus: 0 0 5px $medium-gray;
$input-cursor-disabled: not-allowed;
$table-is-striped: true;
$table-striped-background: smart-scale($table-background, $table-color-scale);
$table-stripe: even;
-$table-head-background: smart-scale($table-background, $table-color-scale / 2);
+$table-head-background: smart-scale($table-background, $table-color-scale * 0.5);
$table-head-row-hover: darken($table-head-background, $table-hover-scale);
$table-foot-background: smart-scale($table-background, $table-color-scale);
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale);
// Max value is 0.2px under the next breakpoint (0.02 / 16 = 0.00125).
// Use a precision under 1px to support browser zoom, but not to low to avoid rounding.
// See https://github.com/foundation/foundation-sites/issues/11313
- $bp-max: if($hidpi, $bp-next - (1/$std-web-dpi), -zf-bp-to-em($bp-next) - 0.00125);
+ $bp-max: if($hidpi, $bp-next - divide(1, $std-web-dpi), -zf-bp-to-em($bp-next) - 0.00125);
}
}
@for $i from 1 through 3 {
$rgb: nth($rgba, $i);
- $rgb: $rgb / 255;
+ $rgb: divide($rgb, 255);
- $rgb: if($rgb < 0.03928, $rgb / 12.92, pow(($rgb + 0.055) / 1.055, 2.4));
+ $rgb: if($rgb < 0.03928, divide($rgb, 12.92), pow(divide($rgb + 0.055, 1.055), 2.4));
$rgba2: append($rgba2, $rgb);
}
// Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
$luminance1: color-luminance($color1) + 0.05;
$luminance2: color-luminance($color2) + 0.05;
- $ratio: $luminance1 / $luminance2;
+ $ratio: divide($luminance1, $luminance2);
@if $luminance2 > $luminance1 {
- $ratio: 1 / $ratio;
+ $ratio: divide(1, $ratio);
}
- $ratio: round($ratio * 10) / 10;
+ $ratio: round($ratio * 10) * 0.1;
@return $ratio;
}
// Calculate the opposite place in a circle, with a starting index of 1
$length: length($dirs);
- $demi: $length / 2;
+ $demi: $length * 0.5;
$opposite-place: (($place + $demi - 1) % $length) + 1;
@return nth($dirs, $opposite-place);
$prec2 : pow(10, $prec);
$exponent: round($exponent * $prec2);
$denominator: gcd($exponent, $prec2);
- @return nth-root(pow($base, $exponent / $denominator), $prec2 / $denominator, $prec);
+ @return nth-root(pow($base, divide($exponent, $denominator)), divide($prec2, $denominator), $prec);
}
$value: $base;
}
@else if $exponent < 1 {
@for $i from 0 through -$exponent {
- $value: $value / $base;
+ $value: divide($value, $base);
}
}
$x: 1;
@for $i from 0 through $prec {
- $x: 1 / $n * (($n - 1) * $x + ($num / pow($x, $n - 1)));
+ $x: divide(1, $n) * (($n - 1) * $x + divide($num, pow($x, $n - 1)));
}
@return $x;
@function ratio-to-percentage($ratio) {
$w: nth($ratio, 1);
$h: nth($ratio, 3);
- @return $h / $w * 100%;
+ @return divide($h, $w) * 100%;
}
/// Parse the given `$fraction` to numerators and denumerators.
}
}
- @return percentage($parsed-nominator / $parsed-denominator);
+ @return percentage(divide($parsed-nominator, $parsed-denominator));
}
$hover-shadow: ();
// Spacing between bars is calculated based on the total height of the icon and the weight of each bar
- $spacing: ($height - ($weight * $bars)) / ($bars - 1);
+ $spacing: divide($height - ($weight * $bars), $bars - 1);
@if unit($spacing) == 'px' {
$spacing: floor($spacing);
@for $i from 2 through $max {
&:nth-last-child(#{$i}):first-child,
&:nth-last-child(#{$i}):first-child ~ #{$elem} {
- width: percentage(1 / $i);
+ width: percentage(divide(1, $i));
}
}
}
// https://get.foundation
// Licensed under MIT Open Source
+@import 'math';
+
////
/// @group functions
////
///
/// @returns {Number} The same number, sans unit.
@function strip-unit($num) {
- @return $num / ($num * 0 + 1);
+ @return divide($num, $num * 0 + 1);
}
/// Converts one or more pixel values into matching rem values.
// If the base font size is a %, then multiply it by 16px
// This is because 100% font size = 16px in most all browsers
@if unit($base) == '%' {
- $base: ($base / 100%) * 16px;
+ $base: divide($base, 100%) * 16px;
}
// Using rem as base allows correct scaling
// Calculate rem if units for $value is not rem or em
@if unit($value) != 'rem' {
- $value: strip-unit($value) / strip-unit($base) * 1rem;
+ $value: divide(strip-unit($value), strip-unit($base)) * 1rem;
}
// Turn 0rem into 0
// If the base font size is a %, then multiply it by 16px
@if unit($base) == '%' {
- $base: ($base / 100%) * 16px;
+ $base: divide($base, 100%) * 16px;
}
@if unit($base) == 'rem' {
// Now let's convert our value to pixels too
@if unit($value) == '%' {
- $value: ($value / 100%) * $base;
+ $value: divide($value, 100%) * $base;
}
@if unit($value) == 'rem' {
// 'px'
@if unit($value) == 'px' {
- @return strip-unit($value) / strip-unit($base);
+ @return divide(strip-unit($value), strip-unit($base));
}
// assume that line-heights greater than 10 are meant to be absolute in 'px'
@if unitless($value) and ($value > 10) {
- @return $value / strip-unit($base);
+ @return divide($value, strip-unit($base));
}
@return $value;
// Output our margin gutters.
@if (type-of($gutters) == 'map') {
@include -zf-breakpoint-value(auto, $gutters) {
- $gutter: rem-calc($-zf-bp-value) / 2;
+ $gutter: rem-calc($-zf-bp-value) * 0.5;
// Loop through each gutter position
@each $value in $gutter-position {
}
}
@else if (type-of($gutters) == 'number') {
- $gutter: rem-calc($gutters) / 2;
+ $gutter: rem-calc($gutters) * 0.5;
// Loop through each gutter position
@each $value in $gutter-position {
$vertical: false,
$output: (base size gutters)
) {
- $size: percentage(1/$n);
+ $size: percentage(divide(1, $n));
& > #{$selector} {
@include xy-cell($size, $gutter-output, $gutters, $gutter-type, $gutter-position, $breakpoint, $vertical, $output);
$offset: $size;
@if ($gutter-type == 'margin') {
- $gutter: rem-calc(xy-cell-gutters($gutters, $breakpoint) / 2);
+ $gutter: rem-calc(xy-cell-gutters($gutters, $breakpoint) * 0.5);
$offset: if($gutter == 0, $size, calc(#{$size} + #{$gutter}));
}
@return $offset;
@include test('Ratio to Percentage [function]') {
$test: ratio-to-percentage(3 by 4);
- $expect: 4 / 3 * 100%;
+ $expect: divide(4, 3) * 100%;
@include assert-equal($test, $expect,
'Creates a percentage value from a ratio');