Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

_mixins.scss 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /**
  2. * Animation mixin.
  3. */
  4. @mixin animation($animate...) {
  5. $max: length($animate);
  6. $animations: '';
  7. @for $i from 1 through $max {
  8. $animations: #{$animations + nth($animate, $i)};
  9. @if $i < $max {
  10. $animations: #{$animations + ", "};
  11. }
  12. }
  13. -webkit-animation: $animations;
  14. -moz-animation: $animations;
  15. -o-animation: $animations;
  16. animation: $animations;
  17. }
  18. @mixin flex() {
  19. display: -webkit-box;
  20. display: -moz-box;
  21. display: -ms-flexbox;
  22. display: -webkit-flex;
  23. display: flex;
  24. }
  25. /**
  26. * Keyframes mixin.
  27. */
  28. @mixin keyframes($animationName) {
  29. @-webkit-keyframes #{$animationName} {
  30. @content;
  31. }
  32. @-moz-keyframes #{$animationName} {
  33. @content;
  34. }
  35. @-o-keyframes #{$animationName} {
  36. @content;
  37. }
  38. @keyframes #{$animationName} {
  39. @content;
  40. }
  41. }
  42. @mixin circle($diameter) {
  43. width: $diameter;
  44. height: $diameter;
  45. border-radius: 50%;
  46. }
  47. @mixin absoluteAligning($sizeX, $sizeY) {
  48. top: 50%;
  49. left: 50%;
  50. position: absolute;
  51. @include transform(translate(-#{$sizeX / 2}, -#{$sizeY / 2}))
  52. }
  53. @mixin transform($func) {
  54. -moz-transform: $func;
  55. -ms-transform: $func;
  56. -webkit-transform: $func;
  57. -o-transform: $func;
  58. transform: $func;
  59. }
  60. @mixin transition($transition...) {
  61. -moz-transition: $transition;
  62. -o-transition: $transition;
  63. -webkit-transition: $transition;
  64. transition: $transition;
  65. }
  66. /**
  67. * Mixin styling placeholder
  68. **/
  69. @mixin placeholder() {
  70. $selectors: (
  71. "::-webkit-input-placeholder",
  72. "::-moz-placeholder",
  73. ":-moz-placeholder",
  74. ":-ms-input-placeholder"
  75. );
  76. @each $selector in $selectors {
  77. #{$selector} {
  78. @content;
  79. }
  80. }
  81. }
  82. @mixin box-shadow($h, $y, $blur, $color, $inset: false) {
  83. @if $inset {
  84. -webkit-box-shadow: inset $h $y $blur $color;
  85. -moz-box-shadow: inset $h $y $blur $color;
  86. box-shadow: inset $h $y $blur $color;
  87. } @else {
  88. -webkit-box-shadow: $h $y $blur $color;
  89. -moz-box-shadow: $h $y $blur $color;
  90. box-shadow: $h $y $blur $color;
  91. }
  92. }
  93. @mixin no-box-shadow {
  94. -webkit-box-shadow: none;
  95. -moz-box-shadow: none;
  96. box-shadow: none;
  97. }
  98. @mixin box-sizing($box-model) {
  99. -webkit-box-sizing: $box-model; // Safari <= 5
  100. -moz-box-sizing: $box-model; // Firefox <= 19
  101. box-sizing: $box-model;
  102. }
  103. @mixin border-radius($radius) {
  104. -webkit-border-radius: $radius;
  105. border-radius: $radius;
  106. /* stops bg color from leaking outside the border: */
  107. background-clip: padding-box;
  108. }
  109. @mixin opacity($opacity) {
  110. opacity: $opacity;
  111. $opacity-ie: $opacity * 100;
  112. -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=$opacity-ie);
  113. filter: alpha(opacity=$opacity-ie); //IE8
  114. }
  115. @mixin text-truncate {
  116. display: block;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. white-space: nowrap;
  120. }