Last active
January 21, 2019 11:44
-
-
Save albb0920/262fffdbb2c52cb4d08b2e87aeded97b to your computer and use it in GitHub Desktop.
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
@function linear-calc($min, $max, $depend-expr, $depend-min, $depend-max) { | |
$range: $max - $min; | |
$grow-rate: $range / ($depend-max - $depend-min); | |
@return calc( | |
#{$min} + (#{$depend-expr} - #{$depend-min}) * #{$grow-rate} | |
); | |
} | |
$min-header-height: 40px; | |
$max-header-height: 80px; | |
@at-root :root { | |
// js onScroll 變更 | |
--header-height: #{$max-header-height}; | |
} | |
@function depend-on-header-height($min, $max) { | |
@return linear-calc( | |
$min: $min, | |
$max: $max, | |
$depend-expr: var(--header-height), | |
$depend-min: $min-header-height, | |
$depend-max: $max-header-height | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment