_media.scss 959 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. @mixin media($query:$feature $value $columns, $total-columns: $grid-columns) {
  2. @if length($query) == 1 {
  3. @media screen and ($default-feature: nth($query, 1)) {
  4. $default-grid-columns: $grid-columns;
  5. $grid-columns: $total-columns !global;
  6. @content;
  7. $grid-columns: $default-grid-columns !global;
  8. }
  9. }
  10. @else {
  11. $loopTo: length($query);
  12. $mediaQuery: 'screen and ';
  13. $default-grid-columns: $grid-columns;
  14. $grid-columns: $total-columns !global;
  15. @if length($query) % 2 != 0 {
  16. $grid-columns: nth($query, $loopTo) !global;
  17. $loopTo: $loopTo - 1;
  18. }
  19. $i: 1;
  20. @while $i <= $loopTo {
  21. $mediaQuery: $mediaQuery + '(' + nth($query, $i) + ': ' + nth($query, $i + 1) + ') ';
  22. @if ($i + 1) != $loopTo {
  23. $mediaQuery: $mediaQuery + 'and ';
  24. }
  25. $i: $i + 2;
  26. }
  27. @media #{$mediaQuery} {
  28. @content;
  29. $grid-columns: $default-grid-columns !global;
  30. }
  31. }
  32. }