Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add active class #54

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 127 additions & 127 deletions css/hover.css

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions less/_options.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
// DEFAULT OPTIONS

// Compile with or without classes
@includeClasses: true;

// Prefix for Hover class names
@nameSpace: hvr;

// Selector used to trigger the animations to an active state
@hoverSelector: ~"&:hover, &:focus, &:active";
& when(@includeClasses = true) {
@hoverSelector: ~"#{@hoverSelector}, &.#{@nameSpace}-active";
}

// Durations
@fastDuration: .1s;
@mediumDuration: .3s;
Expand Down Expand Up @@ -38,6 +47,3 @@
@moz: false;
@ms: false;
@o: false;

// Compile with or without classes
@includeClasses: true;
4 changes: 1 addition & 3 deletions less/effects/2d-transitions/_bob.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
.bob() {
.hacks();

&:hover,
&:focus,
&:active {
@{hoverSelector} {
.prefixed(animation-name, ~"@{nameSpace}-bob-float, @{nameSpace}-bob");
.prefixed(animation-duration, ~".3s, 1.5s");
.prefixed(animation-delay, ~"0s, .3s");
Expand Down
12 changes: 9 additions & 3 deletions scss/_options.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
// DEFAULT OPTIONS

// Compile with or without classes
$includeClasses: true !default;

// Prefix for Hover class names
$nameSpace: 'hvr' !default;

// Selector used to trigger the animations to an active state
$hoverSelector: "&:hover, &:focus, &:active" !default;
@if $includeClasses {
$hoverSelector: "#{$hoverSelector}, &.#{$nameSpace}-active";
}

// Durations
$fastDuration: .1s !default;
$mediumDuration: .3s !default;
Expand Down Expand Up @@ -38,6 +47,3 @@ $webkit: true !default;
$moz: false !default;
$ms: false !default;
$o: false !default;

// Compile with or without classes
$includeClasses: true !default;
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_bob.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
@mixin bob {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, "#{$nameSpace}-bob-float, #{$nameSpace}-bob");
@include prefixed(animation-duration, ".3s, 1.5s");
@include prefixed(animation-delay, "0s, .3s");
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_bounce-in.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
@include hacks();
@include prefixed(transition-duration, $slowDuration);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, scale(1.2));
@include prefixed(transition-timing-function, cubic-bezier(.47,2.02,.31,-0.36));
}
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_bounce-out.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
@include hacks();
@include prefixed(transition-duration, $slowDuration);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, scale(.8));
@include prefixed(transition-timing-function, cubic-bezier(.47,2.02,.31,-0.36));
}
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_buzz-out.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
@mixin buzz-out {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-buzz-out);
@include prefixed(animation-duration, .75s);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_buzz.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
@mixin buzz {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-buzz);
@include prefixed(animation-duration, .15s);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_float.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
@include prefixed(transition-property, transform);
@include prefixed(transition-timing-function, ease-out);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, translateY(-8px));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_grow-rotate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
@include prefixed(transition-duration, $mediumDuration);
@include prefixed(transition-property, transform);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, scale(1.1) rotate(4deg));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_grow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
@include prefixed(transition-duration, $mediumDuration);
@include prefixed(transition-property, transform);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, scale(1.1));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_hang.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
@mixin hang {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, "#{$nameSpace}-hang-sink, #{$nameSpace}-hang");
@include prefixed(animation-duration, ".3s, 1.5s");
@include prefixed(animation-delay, "0s, .3s");
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_pop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@mixin pop {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-pop);
@include prefixed(animation-duration, $mediumDuration);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_pulse-grow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@mixin pulse-grow {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-pulse-grow);
@include prefixed(animation-duration, $mediumDuration);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_pulse-shrink.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@mixin pulse-shrink {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-pulse-shrink);
@include prefixed(animation-duration, $mediumDuration);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_pulse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
@mixin pulse {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-pulse);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_push.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
@mixin push {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-push);
@include prefixed(animation-duration, .3s);
@include prefixed(animation-timing-function, linear);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_rotate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
@include prefixed(transition-duration, $mediumDuration);
@include prefixed(transition-property, transform);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, rotate(4deg));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_shrink.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
@include prefixed(transition-duration, $mediumDuration);
@include prefixed(transition-property, transform);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, scale(.9));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_sink.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
@include prefixed(transition-property, transform);
@include prefixed(transition-timing-function, ease-out);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, translateY(8px));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_skew-backward.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
@include prefixed(transition-property, transform);
@include prefixed(transform-origin, 0 100%);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, skew(10deg));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_skew-forward.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
@include prefixed(transition-property, transform);
@include prefixed(transform-origin, 0 100%);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, skew(-10deg));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_skew.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
@include prefixed(transition-duration, $mediumDuration);
@include prefixed(transition-property, transform);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(transform, skew(-10deg));
}
}
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-bottom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
@include hacks();
@include prefixed(transform-origin, 100% 0);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-bottom);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-horizontal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
@mixin wobble-horizontal {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-horizontal);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-skew.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
@mixin wobble-skew {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-skew);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-to-bottom-right.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
@mixin wobble-to-bottom-right {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-to-bottom-right);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-to-top-right.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
@mixin wobble-to-top-right {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-to-top-right);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-top.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
@include hacks();
@include prefixed(transform-origin, 0 100%);

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-top);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/2d-transitions/_wobble-vertical.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
@mixin wobble-vertical {
@include hacks();

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-wobble-vertical);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-timing-function, ease-in-out);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/background-transitions/_back-pulse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
@include prefixed(transition-duration, $slowDuration);
@include prefixed(transition-property, "color, background-color");

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
@include prefixed(animation-name, #{$nameSpace}-back-pulse);
@include prefixed(animation-duration, 1s);
@include prefixed(animation-delay, $slowDuration);
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/background-transitions/_bounce-to-bottom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
@include prefixed(transition-timing-function, ease-out);
}

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
color: white;

&:before {
Expand Down
4 changes: 1 addition & 3 deletions scss/effects/background-transitions/_bounce-to-left.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
@include prefixed(transition-timing-function, ease-out);
}

&:hover,
&:focus,
&:active {
#{$hoverSelector} {
color: white;

&:before {
Expand Down
Loading