jquery: Flash messages

前端 未结 8 1673
再見小時候
再見小時候 2021-02-12 21:05

With jQuery, how can I display a flash message at the top of the page in an easy way? Is there something built-in, or a plugin, or is it easy enough to do it yourself?

W

相关标签:
8条回答
  • 2021-02-12 21:50

    I ended up using jquery-notice, which is really simple and self-contained. It's MIT licensed, just a zip file with the .js and .css files, and you can call it with something like:

    <script type="text/javascript">
      $(document).ready( function () {
        jQuery.noticeAdd({
            text: '${flash_get()}',
            stay: true
            });
        return false;
        });
    </script>
    

    Though I also liked the solution from @Brian ONeal for Notify Bar, that also looks very simple.

    jquery-notice makes a box for each message on the upper right corner of the page. Notify Bar pulls down from the top edge, and includes a few different styles for errors, regular, or success notices.

    0 讨论(0)
  • 2021-02-12 21:51

    I believe you're looking for something like this: http://projects.zoulcreations.com/jquery/growl/

    0 讨论(0)
提交回复
热议问题