How to simulate effect in stackoverflow on Ruby on Rails?

I want to make a notification as follows:

is it just flash [: notification] with some CSS trick in Ruby on Rails? or is there some other trick on this?

+3
source share
3 answers

You can use this jQuery plugin to simulate the effect. Just wrap JS in a conditional expression that checks for a flash (or session / db if you want a persistent message)

<% if flash[:notice] or session[:notice] or current_user.notifications %>
  $(function () {
    $.notifyBar({
      html: "<%= flash[:notice] %>",
      delay: 2000,
      animationSpeed: "normal"
    });  
  });
<% end %>

You will need to style it, obviously.

+4
source

Ruby On Rails. , CSS. , Javascript , jQuery. .

+2

Yes, in Rails, the way to handle this is with the help of a flashstyle that works.

+2
source

Source: https://habr.com/ru/post/1729904/


All Articles