Skip to content

Commit

Permalink
Create mixin for hamburger icon
Browse files Browse the repository at this point in the history
  • Loading branch information
winghouchan committed May 3, 2014
1 parent 6205dc8 commit 92e1d63
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scss/foundation/components/_global.scss
Expand Up @@ -110,6 +110,52 @@ $base-line-height: 150% !default;
}
}

// @mixins
//
// We use this to create the icon with three lines aka the hamburger icon, the menu-icon or the navicon
// $width - Width of hamburger icon in rem
// $left - If false, icon will be centered horizontally || explicitly set value in rem
// $top - If false, icon will be centered vertically || explicitly set value in rem
// $thickness - thickness of lines in hamburger icon, set value in px
// $gap - spacing between the lines in hamburger icon, set value in px
// $color - icon color
// $hover-color

@mixin hamburger($width, $left, $top, $thickness, $gap, $color, $hover-color) {
span:after {
content: '';
position: absolute;
display: block;
height: 0;

@if $top {
top: $top;
}
@else {
top: ($width - rem-calc(3 * $thickness) - rem-calc(2 * $gap))/2;
}
// disable width centering if $top is not false
@if $left {
left: $left;
}
@else {
left: 0;
}

box-shadow:
0 0px 0 $thickness $color,
0 $gap + $thickness 0 $thickness $color,
0 (2 * $gap + 2*$thickness) 0 $thickness $color;
width: $width;
}
&:hover {
box-shadow:
0 0px 0 $thickness $hover-color,
0 $gap + $thickness 0 $thickness $hover-color,
0 (2 * $gap + 2*$thickness) 0 $thickness $hover-color;
}
}

// We use this to do clear floats
@mixin clearfix {
&:before, &:after { content: " "; display: table; }
Expand Down

0 comments on commit 92e1d63

Please sign in to comment.