Revision: 52779
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 1, 2011 15:08 by jackkeller
Initial Code
$(document).ready(function() { jQuery.fn.center = function () { this.css("position","absolute"); this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px"); this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px"); return this; } $("#id").center(); });
Initial URL
Initial Description
Initial Title
Center an element on the screen
Initial Tags
jquery
Initial Language
JavaScript