Last active
March 15, 2021 16:03
-
-
Save jwood/90e7bf6873774055b169 to your computer and use it in GitHub Desktop.
Disable animations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- app/views/layouts/application.html.erb --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- ... --> | |
<% if Rails.application.config.disable_animations %> | |
<%= stylesheet_link_tag('disable_animations') %> | |
<!-- Turn off animations in jQuery --> | |
<script>$.fx.off = true;</script> | |
<% end %> | |
</head> | |
<body> | |
<!-- ... --> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/application.rb | |
module Urbanbound | |
class Application < Rails::Application | |
# ... | |
config.disable_animations = false | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Disable animations, only for test environments.*/ | |
* { | |
-webkit-transition: none !important; | |
-moz-transition: none !important; | |
-ms-transition: none !important; | |
-o-transition: none !important; | |
transition: none !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/test.rb | |
Rails.application.configure do | |
# ... | |
config.disable_animations = true | |
end |
_disable_animations.html.haml
- if Rails.application.config.disable_animations
= stylesheet_link_tag('disable_animations')
/ Turn off animations in jQuery
:javascript
$.fx.off = true;
config/initializers/assets.rb
Rails.application.config.assets.precompile += %w[disable_animations.scss] if Rails.env.test?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to add these extra transitions to get everything (bootstrap animations included) to disable: