Skip to content

Instantly share code, notes, and snippets.

@rgo
Forked from leehambley/gist:332857
Created March 15, 2010 15:26
Show Gist options
  • Save rgo/332945 to your computer and use it in GitHub Desktop.
Save rgo/332945 to your computer and use it in GitHub Desktop.
Snippet to hide flash messages automagically with jQuery
<%# From pretty_flash by rpheath (improved by pacoguzman) %>
<% if flash.any? -%>
<script type="text/javascript">
$(function() {
setTimeout(hideFlashes, 5000);
});
var hideFlashes = function() {
$("[id^='flash_']").fadeOut(1500);
}
</script>
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment