jQuery.fn.center=function(){
this.css("position","absolute");
this.css("top",(($(window).height()-this.outerHeight())/2)+$(window).scrollTop()+"px");
this.css("left",(($(window).width()-this.outerWidth())/2)+$(window).scrollLeft()+"px");
return this;
}
Now we can just write:
$(element).center();
thanks bro such an informative
ReplyDeleteOffshore Software Development Company
Zend Development Company
That's what I call short but very useful. Thanks for sharing the little tip of adjustments. I look forward to more tutorials you'll be providing.
ReplyDelete