Posted By

metoikos on 09/26/09


Tagged

jquery


Versions (?)

jquery center content to page


 / Published in: JavaScript
 

  1. jQuery.fn.center = function () {
  2. this.css("position","absolute");
  3. this.css("top", ( $(window).height() - this.height() ) / $(window).scrollTop() + "px");
  4. this.css("left", ( $(window).width() - this.width() ) / $(window).scrollLeft() + "px");
  5. return this;
  6. }

Report this snippet  

You need to login to post a comment.