Last active
April 5, 2016 13:56
-
-
Save mrkrand/e52792a4cf87f6e1f94c94bc578d24a9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@mixin drop-down($background: #fff, $textColor: #000, $borderColor: #ccc) { | |
display: inline-block; | |
border: none; | |
position: relative; | |
background-color: $background; | |
margin-right: 23px; | |
> span { | |
color: $textColor; | |
padding: 12px 42px 12px 15px; | |
font-size: 16px; | |
display: block; | |
cursor: pointer; | |
border: 1px solid $borderColor; | |
transition: color .2s ease-in-out; | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
&:after, &:before { | |
right: 12px; | |
top: 31px; | |
border: solid transparent; | |
content: " "; | |
height: 0; | |
width: 0; | |
position: absolute; | |
pointer-events: none; | |
} | |
&:after { | |
border-color: rgba(84, 89, 91, 0); | |
border-top-color: $background; | |
border-width: 5px; | |
margin-top: -9px; | |
right: 13px; | |
} | |
&:before { | |
border-color: rgba(255, 255, 255, 0); | |
border-top-color: $borderColor; | |
border-width: 6px; | |
margin-top: -8px; | |
} | |
} | |
&:hover { | |
> span { | |
color: darken($color, 20%); | |
} | |
} | |
ul { | |
display: none; | |
padding-left: 0; | |
position: absolute; | |
background: $background; | |
z-index: 200; | |
width: 100%; | |
border: 1px solid $borderColor; | |
padding-top: 4px; | |
padding-bottom: 4px; | |
margin: 0; | |
list-style: none; | |
li { | |
a { | |
color: #000; | |
text-decoration: none; | |
display: inline-block; | |
padding-left: 15px; | |
padding-right: 12px; | |
padding-top: 4px; | |
padding-bottom: 4px; | |
} | |
} | |
} | |
&.open { | |
> span { | |
&:after, &:before { | |
right: 12px; | |
top: 28px; | |
} | |
&:after { | |
border-color: rgba(84, 89, 91, 0); | |
border-bottom-color: $background; | |
border-width: 5px; | |
margin-top: -9px; | |
right: 13px; | |
} | |
&:before { | |
border-color: rgba(255, 255, 255, 0); | |
border-bottom-color: $borderColor; | |
border-width: 6px; | |
margin-top: -12px; | |
} | |
} | |
ul { | |
display: block; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment