Posted By

insanedreamer on 08/04/10


Tagged

javascript prototype rails3


Versions (?)

easy flash display with prototype


 / Published in: Rails
 

  1. ## application.haml
  2.  
  3. #notices{:style => 'display:none;'}= flash[:notice]
  4.  
  5. ## application.js
  6.  
  7. // every page reload
  8. document.observe("dom:loaded", function() {
  9. show_notices()
  10. })
  11.  
  12. // notices
  13. var show_notices = function () {
  14. if (!$('notices').empty()) {
  15. $('notices').appear( { duration: 3, from: 0, to: 1, queue: 'front' } )
  16. $('notices').fade( { duration: 3, from: 1, to: 0, queue: 'end' } )
  17. }
  18. }

Report this snippet  

You need to login to post a comment.