66// hover or a click.
77
88// Mixin: Hover Darken
9- //
9+ //
1010// Darkens the color and/or background color on your element when it's hovered.
1111// Takes an optional percentage to darken it.
12- //
12+ //
1313// ex. hover-darken()
1414// ex. hover-darken: 30%
1515
@@ -25,9 +25,9 @@ hover-darken(percent = 15%, forceUseColor = false)
2525 warn ('you need to set a color or background color on your element for this to work' )
2626
2727// Mixin: Hover Lighten
28- //
28+ //
2929// Works the same way as hover-darken but lightens the color.
30- //
30+ //
3131// ex. hover-lighten()
3232// ex. hover-lighten: 30%
3333
@@ -43,34 +43,34 @@ hover-lighten(percent = 15%, forceUseColor = false)
4343 warn ('you need to set a color or background color on your element for this to work' )
4444
4545// Mixin: Hover Underline
46- //
46+ //
4747// This one is interesting, and may need tweaking to get it to work right on the
4848// intended element. Works very nicely for text like in a span, and can animate.
49- //
49+ //
5050// ex. hover-underline()
5151// ex. hover-underline: 2px 'dotted'
5252
5353hover-underline (borderSize = 1px , type = 'solid' , color = null )
5454 border-bottom : borderSize unquote (type ) transparent
55-
55+
5656 & :hover
5757 border-bottom : borderSize unquote (type ) color
5858
5959// Mixin: Hover Pop
60- //
60+ //
6161// On hover, your element pops out from the page. For scale, it takes an integer
6262// or float, 1 represents 100%, 2 is 200%, etc. Optionally can also rotate,
6363// pass it a number followed by "deg", like 180deg. If you pass true for
6464// shadow, it will animate in a drop shadow to add to the effect.
65- //
65+ //
6666// ex. hover-pop: 1.5
6767// ex. hover-pop: 2.6 90deg
6868// ex. hover-pop: 1.2 45deg true
6969
7070hover-pop (scale = 1.2 , rotate = null , shadow = null )
7171 if shadow
7272 box-shadow : 0 0 1px transparent
73-
73+
7474 & :hover
7575 position : relative
7676 z-index : 10
@@ -81,7 +81,7 @@ hover-pop(scale = 1.2, rotate = null, shadow = null)
8181 transform : scale (scale ) rotate (rotate )
8282
8383// Mixin: Hover Fade
84- //
84+ //
8585// On hover, fades the element's opacity down. Takes an amount as an integer
8686// between 0 and 1, like opacity normally does. Recommended to be used with
8787// transition.
@@ -93,11 +93,11 @@ hover-fade(amount = .5)
9393 opacity : amount
9494
9595// Mixin: Hover Color
96- //
96+ //
9797// Will swap an elements color or background color on hover. Takes a color in
9898// any format as the first argument. Will first look for a background color to
9999// change, then a color.
100- //
100+ //
101101// ex. hover-color: #D45D86
102102
103103hover-color (color , forceUseColor = false )
@@ -113,7 +113,85 @@ hover-color(color, forceUseColor = false)
113113 else
114114 warn ('you need to set a color or background color on your element for this to work' )
115115
116- // TODO:
117- // *+click-down(pixels)*
118- // *+click-shadow(radius)*
119- // *+button-interaction(color)*
116+ // Mixin: Hover Glow
117+ //
118+ // Creates a glow when hovering an element. Takes a color and a radius (size).
119+ // Recommended to be used with transition.
120+ //
121+ // ex: hover-glow()
122+
123+ hover-glow ($color = rgba (blue, .8 ), $radius = 20px )
124+ & :hover
125+ box-shadow : 0px 0px $radius 2px $color
126+
127+ // Mixin: Hover Float
128+ //
129+ // Gives an element the effect of rising up vertically with a small shadow
130+ // underneath. Recommended to be use with transition.
131+ //
132+ // Ex: hover-float()
133+
134+ hover-float ()
135+ position : relative
136+
137+ & :before
138+ pointer-events : none
139+ position : absolute
140+ z-index : - 1
141+ content : ''
142+ top : 108%
143+ left : 5%
144+ height : 10px
145+ width : 90%
146+ opacity : 0
147+ background : radial-gradient (ellipse at center , rgba (0 , 0 , 0 , 0.25 ) 0% , rgba (0 , 0 , 0 , 0 ) 80% )
148+
149+ & :hover
150+ transform : translateY (- 7px )
151+ & :before
152+ opacity : 1
153+ transform : scale (1 )
154+
155+ // Mixin: Click Down
156+ //
157+ // Move an element down while clicked/tapped. Takes distance.
158+ //
159+ // ex: click-down()
160+
161+ click-down ($distance = 1px )
162+ & :active
163+ transform : translateY ($distance )
164+
165+ // Mixin: Click Shadow
166+ //
167+ // Creates a shadow under element while clicked/tapped. Takes distance and
168+ // radius (size). Recommended to be use with transition.
169+ //
170+ // ex: click-shadow()
171+
172+ click-shadow ($distance = 2px , $radius = 10px )
173+ & :active
174+ box-shadow : 0px $distance $radius 2px rgba (0 , 0 , 0 , 0.25 )
175+
176+ // Mixin: Click Inset
177+ //
178+ // Creates an inset shadow on an elment while clicked/tapped. Takes radius
179+ // (inset shadow size). Recommended to be use with transition.
180+ //
181+ // ex: click-inset()
182+
183+ click-inset ($radius = 20px )
184+ $distance = $radius / 2
185+ & :active
186+ box-shadow : inset 0px $distance $radius rgba (0 , 0 , 0 , 0.35 );
187+
188+ // Mixin: Click Shrink
189+ //
190+ // Scale down an element when clicked/tapped. Gives the effect of "sinking"
191+ // or lowering on the z-axis.
192+ //
193+ // ex: click-shrink()
194+
195+ click-shrink ($distance = .92 )
196+ & :active
197+ transform : scale ($distance )
0 commit comments