×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: A973C FR
Added: Sep 24, 2012 5:28 AM
Views: 1777
  1.     $.fn.center = function() {
  2.     this.css("position", "absolute");
  3.     this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
  4.     this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
  5.     return this
  6.     };