Create a gist now

Instantly share code, notes, and snippets.

Disable animations
<!-- 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>
# config/application.rb
module Urbanbound
class Application < Rails::Application
# ...
config.disable_animations = false
end
end
/* 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;
}
# config/environments/test.rb
Rails.application.configure do
# ...
config.disable_animations = true
end
@jersingh

Had to add these extra transitions to get everything (bootstrap animations included) to disable:

transition-property: none !important;
 -o-transition-property: none !important;
 -moz-transition-property: none !important;
 -ms-transition-property: none !important;
 -webkit-transition-property: none !important;

 transform: none !important;
 -o-transform: none !important;
 -moz-transform: none !important;
 -ms-transform: none !important;
 -webkit-transform: none !important;

 animation: none !important;
 -o-animation: none !important;
 -moz-animation: none !important;
 -ms-animation: none !important;
 -webkit-animation: none !important;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment