@mixin arrow(
$arrow-direction: top,
$arrow-width: 20px,
$arrow-height: 20px,
$arrow-color: #007bff) {
position: absolute;
width: 0;
height: 0;
border-style: solid;
-webkit-transform:rotate(360deg); /* for a better anti-aliasing in webkit browser */
/* border-style: inset */ /* Try if Firefox renders a strange gray border */
@if $arrow-direction == top {
border-width: 0 $arrow-width / 2 $arrow-height $arrow-width / 2;
border-color: transparent transparent $arrow-color transparent;
}
@if $arrow-direction == top-right {
border-width: 0 $arrow-width $arrow-height 0;
border-color: transparent $arrow-color transparent transparent;
}
@if $arrow-direction == right {
border-width: $arrow-height / 2 0 $arrow-height / 2 $arrow-width;
border-color: transparent transparent transparent $arrow-color;
}
@if $arrow-direction == bottom-right {
border-width: 0 0 $arrow-height $arrow-width;
border-color: transparent transparent $arrow-color transparent;
}
@if $arrow-direction == bottom {
border-width: $arrow-height $arrow-width / 2 0 $arrow-width / 2;
border-color: $arrow-color transparent transparent transparent;
}
@if $arrow-direction == bottom-left {
border-width: $arrow-height 0 0 $arrow-width;
border-color: transparent transparent transparent $arrow-color;
}
@if $arrow-direction == left {
border-width: $arrow-height / 2 $arrow-width $arrow-height / 2 0;
border-color: transparent $arrow-color transparent transparent;
}
@if $arrow-direction == top-left {
border-width: $arrow-height $arrow-width 0 0;
border-color: $arrow-color transparent transparent transparent;
}
}