Return to Snippet

Revision: 51722
at October 2, 2011 05:20 by claudiowebdesign

Initial Code
 *  Facebook notifications with jQuery [v1.0]
 *  Distributed under the Do-wathever-the-hell-you-want-with-it License
 *  Web site:
 *  Blog:
 *  Email:      [email protected]
 *  Twitter:    @ClaudioBonifazi
        $.fn.setPopup = function( time ){
                var el = $(this)
                time = (time===undefined) ? 5000 : time;
                el  .data('hover',false)
                                clearTimeout( $(this).data('timeout') )
                        }).live('mouseout', function(){
                                var a = setTimeout(function(){
                        return false
                return el
        $.fn.callPopup = function callPopup(msg){
                var el = $(this)
                msg = (typeof msg != 'object') ? new Array(msg) : msg;
                        el.prepend('<div><a href="#" title="close">X</a>'+m+'</div>')
                        var a = setTimeout(function(){
                return el
*  jQuery(document).ready(function($){
*               popup = $('#tips')
*               popup.setPopup()
*               $('a').click(function(){
*                       popup.callPopup('You\'ve got a new <a href="#" title="notifications  panel">notification</a>.')
*               return false
*       })
* })

Initial URL

Initial Description
I tried to create a little jQuery method to notify events to the user just as in facebook.


1- Link this little plugin to your page (or paste it into your files as you wish)

2- add to your page an empty element (a div or similar) and on page load call $('thatdiv').setPopup()

3- Set that element to position:fixed and position it where you like (in this page it has left:50px and bottom:50px)

4- Whenever an event requires the appearing of one of those little popups, do $('thatdiv').callPopup('html content to place inside it')

5- For styling read the demo page's source as a guideline

Initial Title
Facebook like notifications with jQuery

Initial Tags
jquery, facebook

Initial Language