Talked about this over here: http://groups.google.com/group/jquery-ui/browse_thread/thread/35a33d1c50f0e724/e527c8f47ba183e0?lnk=gst&q=extend+center#e527c8f47ba183e0
This is my extension to centre a div to the screen: $(document).ready(function() { jQuery.fn.centerScreen = function(loaded) { var obj = this; if(!loaded) { obj.css('top', $(window).height()/2- this.height()/2); obj.css('left', $(window).width()/2- this.width()/2); $(window).resize(function() { obj.centerScreen(!loaded); }); } else { obj.stop(); obj.animate({ top: $(window).height()/2- this.height()/2, left: $ (window).width()/2-this.width()/2}, 200, 'linear'); } } }); On Feb 19, 12:20 pm, Shawn <[EMAIL PROTECTED]> wrote: > I seem to remember seeing a center() plugin once. But that was pre 1.2 > days, so it may not be applicable anymore. > > Regardless, the best way I know of to center a DIV is to use CSS. > Something like this: > > #mydiv { margin: 20%; } > or even { margin: auto } in some cases. > > There's PLENTY on this topic on the > webhttp://www.google.ca/search?hl=en&q=css%20center%20div&meta= > > HTH > > Shawn > > > > Ryura wrote: > > Hi everyone, > > > I'm wondering the best way to center a div horizontally and vertically > > on the fly. > > > I have: > > jQuery("a").click(function () { > > jQuery("#box")./*verticalCenter().*/ > > add("#loading").show(); > > }); > > > Basically I just want #box to be centered on the screen and then > > shown. I'm clueless as to how to do this, however. I tried using an > > excerpt from an older version of the Dimensions plugin that I found on > > here, but it seems to be outdated now (it doesn't work in Safari). > > > Thanks!- Hide quoted text - > > - Show quoted text -