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 web
http://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!