Sass mixin with if else

后端 未结 5 2065
借酒劲吻你
借酒劲吻你 2021-01-01 13:51

i have the following mixin

@mixin arrows($arrowdirection:\"left\", $arrowsize:\"5px\", $arrowcolor:$navbgblue ) {
            


        
5条回答
  •  北海茫月
    2021-01-01 14:38

    yeah there is definately a bug of some sort, with the optimization. But this works

    @mixin leftarrow($size:5px, $direction:left) {
      border-width: $size;
      border-color: transparent;
      border-style: solid;
      display: inline-block;
      height: 0px;
      width: 0px;
    
      @if $direction == "right" {
       border-left-color: $navbgblue;
       border-right-width: 0px;
     } @else if $direction == "left" {
       border-right-color: $navbgblue;
       border-left-width: 0px;
     } @else if $direction == "up" {
       border-bottom-color: $navbgblue;
       border-top-width: 0px;
     } @else if $direction == "down" {
       border-top-color: $navbgblue;
       border-bottom-width: 0px;
     }
    }
    
    .test{
      @include leftarrow(5px, up);
    }
    

    so i'll use that :-)

提交回复
热议问题