jQuery CenterOnPoint

This came in handy on a project of mine. Simple jQuery extension that centers a jQuery element (or elements) on a set of coordinates.

jQuery.fn.extend({
   centerOnPoint : function(coords) {
       var left = coords.left - Math.round($(this).width()/2);
       var top = coords.top - Math.round($(this).height()/2);
       $(this).css({"position":"absolute", "left":left, "top":top})
   }
});