center element on screen in jQuery

Loading ...
jQuery.fn.center = function () {
this.css('position','absolute');
this.css('top', ( $(window).height() - this.height() ) / +$(window).scrollTop() + 'px');
this.css('left', ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + 'px');return this;}
//Use the above function as: $(element).center();
You may want to check :
- make an entire list element (LI) clickable
- Absolute Center (Vertical & Horizontal) an Image
- Clean way to open popup windows
- Do … to an element when it comes into the view by scrolling
- center an element on screen