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

Added animation effects for fade and slide #68

Merged
merged 3 commits into from
Jan 6, 2017

Conversation

colintucker
Copy link
Contributor

Hey UC!

I started using your handy module today for a project and I felt inspired to add some animation effects. These are just regular old-fashioned jQuery animations, nothing special. I've added a method to DisplayLogicCriteria called useAnimation(). It works like so:

$toggle->displayIf('ToggleMe')->isChecked()->useAnimation('toggle');
$fade->displayIf('FadeMe')->isChecked()->useAnimation('fade');
$slide->displayIf('SlideMe')->isChecked()->useAnimation('slide');

The default animation method is toggle if useAnimation is not called (i.e. the default display logic behaviour). My JavaScript is not the best so hopefully you can review that and see if I've done anything silly, though it seems to work. 😜

I hope the PR can be of some benefit! 😃

Cheers,

Colin.

@colintucker
Copy link
Contributor Author

Hmm, I just noticed a problem in my testing with an undefined animation data attribute, I'll update the branch with a fix.

@unclecheese
Copy link
Owner

Nice one! I'll have a look at this. I was actually thinking recently that the toggling is a bit jarring!

@colintucker
Copy link
Contributor Author

Okie dokes, I think that fixed the attribute bug. As a bonus, I also added config for the default animation method, which can be set in the YAML, or via:

DisplayLogicCriteria::set_default_animation('fade');

That way, you won't need to use ->useAnimation('fade') on everything if you like that animation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants