easy flash display with prototype


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.