Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
Flash message fade effect

I'm trying to use a flash message with a fade in and out effect using jQuery. can someone please suggest the best way of doing this?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Sure:

$(function() {
   $('#flash').delay(500).fadeIn('normal', function() {
      $(this).delay(2500).fadeOut();
   });
});

jsFiddle example

over 4 years ago · Santiago Trujillo Report

0

This is a modification of Jacob's answer above. You can't fade in something that isn't hidden initially.

Instructions:

put an id of flash into your flash message, like this (my flash messages are stored here app/views/layouts/_flashmessages.html.erb):

<% flash.each do |key, value| %>
    <div class="well lead" id="flash"><%= value %></div>
<% end %>

make a new file called assets/javascripts/flash.js.coffee

put this in (beware of spaces, make sure all indentations are tabs):

jQuery ->

    $('#flash').hide().delay(800).fadeIn(800).delay(4000).fadeOut(800)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!