Forums

Center element in window issue…

Below is a snippet of code I’m working on…essentially it animates an element to the browser top. I’m attempting to center the element in the browser window rather than offsetting 0px from the top. If anyone could please suggest a method for accomplishing this, I’d be ever so grateful. Thanks.

Code:

$(‘html,body’).clearQueue().animate({

scrollTop: $(‘#element’).offset().top – 0

}, 400);

Edit:

I’ve been attempting to work something like the following into function with out any luck…