-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
base: master
Are you sure you want to change the base?
Add active class #54
Conversation
Thanks for the idea. Are you using JavaScript to add the active class when the element is hovered over? |
Ah, I see. I thought you meant you wanted the animation to stay stuck on after first play through. I like the idea of the active class and would be happy to merge if you were able to flesh it out. I think it best this only work when Thanks! |
Abstracted the "&:hover, &:active, ..." selector string so that the hvr-active class can be made conditional on the includeClasses variable.
Unfortunately less does not expand out the parent reference & if it is inside of a variable :(
I went ahead and implemented this in sass, and tested out all the effects still worked on the index page. I haven't been able to come up with a good way to make this work in less though :| Parent references found in a variable don't seem to resolve and so it compiles to: |
Closest I've come to getting this working in LESS is this: In .hoverSelector() {
& when(@includeClasses = false) {
&:hover, &:focus, &:active {
.effectProperties();
}
}
& when(@includeClasses = true) {
&:hover, &:focus, &:active, &.@{nameSpace}-active {
.effectProperties();
}
}
} For each effect ( /* Grow */
.grow() {
.hacks();
.prefixed(transition-duration, @mediumDuration);
.prefixed(transition-property, transform);
.hoverSelector();
.effectProperties() {
.prefixed(transform, scale(1.1));
}
} It works fine but not too keen on the fact that the properties aren't declared in |
In our project we are using the underline-from-center animation when hovering over links in our navigation bar to add a little ✨. What we need though is a way to keep the final state of the animation active, so that we can underline the current page the user is on.
I whipped together a quick test of it on just the effect we need and its working. If you like the idea I can flesh out this PR and apply it across all the effects and the less files as well.
I could only include it if $includeClasses is true, or perhaps introduce a new variable to control its presence?