-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 toggleClass parameter for setClassToggle #421
base: master
Are you sure you want to change the base?
Conversation
…than addClass/removeClass
Hi @kasparsj ! Why should this be an option? In theory both behaviours should be the same, no? |
It's a long time since... but I think, I found it more useful to use toggleClass, maybe there was no other way to detect whether the class is on or off. |
Could you elaborate? How exactly are the behaviours different? |
the first will always "addClass" on "enter", and "removeClass" on "leave". the second can do opposite (remove on enter, add on leave), and it can also work in conjunction with another logic (if another logic is also toggling the classes on/off). |
mh you raise a very good point. But shouldn't this be default behaviour? Unless I'm forgetting something the current behaviour would still work with your toggle-class function. |
Yes, I think it should be the default behaviour, but maybe having the current behaviour can also be handy in certain cases. |
but that's kind of my point. I get that using "real" toggle adds functionality, as you could invert the logic. |
No, I can't think of any good example right now... |
I think we should change the behaviour alltogether then. |
when set to true will use toggleClass, rather than addClass/removeClass