Forums

  • # July 5, 2013 at 12:10 pm

    Hello,

    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…

    $(window).height() / 2) – $(‘#element’).height() / 2)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag