Skip to content

Instantly share code, notes, and snippets.

@lesjames
Created March 17, 2012 23:53
Show Gist options
  • Save lesjames/2066736 to your computer and use it in GitHub Desktop.
Save lesjames/2066736 to your computer and use it in GitHub Desktop.
MQ Mixin Loop
// this throws and error when trying to use a function to generate the min-width
@function width($col:1, $base:1) { @return (($col * ($column + $gutter) - $gutter) / $base) / $em; }
@mixin respond-to($size) {
@for $i from 5 through 16 {
@if ($size == $i) { @media (min-width: width($i)) { @content } }
}
}
@mixin respond-to($size) {
@if ($size == 5) { @media (min-width: 24em) { @content } }
@if ($size == 6) { @media (min-width: 28.5em) { @content } }
@if ($size == 7) { @media (min-width: 33em) { @content } }
@if ($size == 8) { @media (min-width: 37.5em) { @content } }
@if ($size == 9) { @media (min-width: 42em) { @content } }
@if ($size == 10) { @media (min-width: 46.5em) { @content } }
@if ($size == 11) { @media (min-width: 51em) { @content } }
@if ($size == 12) { @media (min-width: 55.5em) { @content } }
@if ($size == 13) { @media (min-width: 60em) { @content } }
@if ($size == 14) { @media (min-width: 64.5em) { @content } }
@if ($size == 15) { @media (min-width: 69em) { @content } }
@if ($size == 16) { @media (min-width: 73.5em) { @content } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment