Created
March 20, 2017 06:36
-
-
Save demoon84/3579c5740188d8d48a78dd70ffed404e to your computer and use it in GitHub Desktop.
breakpoint mixin
This file contains 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
// Breakpoint | |
$mobile: 320px; | |
$mobileMax: 425px; | |
$tablet: 640px; | |
$pc: 960px; | |
$max: 1260px; | |
$hidpi: "$hidpi"; | |
@mixin breakpoint($name) { | |
@if $name == "$hidpi" { | |
@media (-webkit-min-device-pixel-ratio: 1.5), | |
(min--moz-device-pixel-ratio: 1.5), | |
(-o-min-device-pixel-ratio: 3/2), | |
(min-device-pixel-ratio: 1.5), | |
(min-resolution: 1.5dppx) { | |
@content; | |
} | |
} | |
@else { | |
// $value: map-get($breakpoints, $name); // If the key exists in the map | |
$value : $name; | |
@if $value != null { // Prints a media query based on the value | |
@media (min-width: $value) { | |
@content; | |
} | |
} | |
} | |
} | |
@include breakpoint($tablet){} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment