Skip to content

Instantly share code, notes, and snippets.

@umanda
Created August 19, 2021 13:24
Show Gist options
  • Save umanda/8b5b83524cf03258c0df59728e56cb54 to your computer and use it in GitHub Desktop.
Save umanda/8b5b83524cf03258c0df59728e56cb54 to your computer and use it in GitHub Desktop.
clamping number
function clamp(value, min, max) {
return min < max
? (value < min ? min : value > max ? max : value)
: (value < max ? max : value > min ? min : value)
}
//https://css-tricks.com/snippets/sass/clamping-number/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment