Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center element in window issue…

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #46134
    Rugg
    Participant

    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)

    #141679
    Paulie_D
    Member
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.