Skip to content

Instantly share code, notes, and snippets.

@paulmsmith
Created September 19, 2012 09:57
Show Gist options
  • Save paulmsmith/3748794 to your computer and use it in GitHub Desktop.
Save paulmsmith/3748794 to your computer and use it in GitHub Desktop.
amended respond-min and respond-max from @jaffathecake
@mixin respond-min($width, $fix-mqs: $fix-mqs) {
// If we're outputting for a fixed media query set...
@if $fix-mqs {
// ...and if we should apply these rules...
@if $fix-mqs >= $width {
// ...output the content the user gave us.
@content;
}
}
@else {
// Otherwise, output it using a regular media query
@media screen and (min-width: $width) {
@content;
}
}
}
@mixin respond-max($width, $fix-mqs: $fix-mqs) {
// If we're outputting for a fixed media query set...
@if $fix-mqs {
// ...and if we should apply these rules...
@if $fix-mqs <= $width {
// ...output the content the user gave us.
@content;
}
}
@else {
// Otherwise, output it using a regular media query
@media screen and (max-width: $width) {
@content;
}
}
}
// being able to pass in false for the hopefully rare cases you need to not have it output to IE stylesheet.
// for example when using something like bootstrap's .hide-desktop, etc
@include respond-max($breakPointC, $fix-mqs: false) {
.foo {
display: block;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment