0

I am calling my flash messages through this function:

function check_notice(visible_for) {
  notice = $('.notice').text();
$('#block').show();
    $('.notice_container').center().show().delay(visible_for).animate({
      'opacity' : '0'
    }, 2000, function() {
      $('.notice_container').css({'opacity':'1', 'display':'none'});
      $('.notice').empty();
      $('#block').hide();
    });
}

$.fn.center = function () {
    this.css("position","absolute");
    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
    this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");

    return this;
}

.center() is meant for messages to be displayed in center. But when I use, there is no message displaying and when I remove center(), messages are shown at the top. Please help me.

venkat
  • 796
  • 1
  • 10
  • 28

0 Answers0