How to display a pop up notification to the user using jquery?

后端 未结 4 498
遥遥无期
遥遥无期 2021-01-31 19:02

I am developing an application which requires that user must be notified about some background events i.e. invitation from other user, reminder time out etc.

Whenever t

4条回答
  •  抹茶落季
    2021-01-31 20:03

    this will give a notification similar to the stackoverflow

    jQuery

    $("#notification").fadeIn("slow").append('your message');
    $(".dismiss").click(function(){
           $("#notification").fadeOut("slow");
    });
    

    HTML

    
    

    CSS

    #notification {
        position:fixed;
        top:0px;
        width:100%;
        z-index:105;
        text-align:center;
        font-weight:normal;
        font-size:14px;
        font-weight:bold;
        color:white;
        background-color:#FF7800;
        padding:5px;
    }
    #notification span.dismiss {
        border:2px solid #FFF;
        padding:0 5px;
        cursor:pointer;
        float:right;
        margin-right:10px;
    }
    #notification a {
        color:white;
        text-decoration:none;
        font-weight:bold
    }
    

    Also take a look at mplungjan's answer on how to listen to server updates and message load

提交回复
热议问题