How to implement jQuery background messages?

For example, when you get a new icon when the stack overflows, you get a misunderstanding message from the top, saying that you have a new icon, it deos that on backgroung! is this a total or an article that can help me with this kind of update events!

+4
source share
1 answer

You should see notifications like jGrowl . There are several examples on the site that will help you get started :)

EDIT

How will you store notifications? Inside the db? I will come back to you later. My lunch break is over :(

EDIT 2

Here is a basic example of how to make it work with php by declaring an array of messages that you can easily populate from the database. You can make it more advanced by using other parameters offered by jGrowl, such as sheets, etc. Using a multidimensional array to store such parameters and output the correct javascript.

<?php $messages = array("This is a message", "And this is another", "etc..."); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>jGrowl and PHP Test</title> <link type="text/css" rel="stylesheet" href="jquery.jgrowl.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.jgrowl.js"></script> <script type="text/javascript"> $(document).ready(function() { <?php foreach ($messages as $message) { ?> $.jGrowl("<?php echo $message; ?>", { life: 3000 }); <?php } ?> }); </script> </head> <body> </body> 

0
source

All Articles