Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:36:39+00:00 2026-06-08T11:36:39+00:00

For some reason the DIV I want to animated is animating from the top

  • 0

For some reason the DIV I want to animated is animating from the top down… I want to animate it from where it is UP to the end destination.

The DIV is starting as position: fixed to the bottom of the page.

This is what I’m doing right now:

var div2Pos = $("#feature-header-wrapper").position();
$("#123456").css('position', 'absolute');
$("#123456").animate({top: div2Pos.top}, 1000);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:36:41+00:00Added an answer on June 8, 2026 at 11:36 am

    I think that this is what you want:

    Demo: http://jsfiddle.net/SO_AMK/Q6KNk/

    jQuery:

    var div2Pos = $("#div2").position();
    $("#square").css({
        position: 'absolute',
        top: $("#square").position().top,
        left: $("#square").position().left
    });
    $("#square").animate({
        top: div2Pos.top
    }, 1000);​
    

    HTML:

    <div id="square">Lorem Ipsum...</div>
    <div id="div2">Lorem Ipsum...</div>​
    

    CSS:

    #square {
        width: 100px;
        height: 100px;
        background-color: lightBlue;
        position: fixed;
        bottom: 0;
    }
    #div2 {
        width: 100px;
        height: 100px;
        background-color: lightGreen;
        position: relative;
        top: 30px;
    }
    

    Basically it gets div2‘s position then sets #square to it’s current position but using absolute instead of fixed positioning so that the animation occurs instead of it jumping to the top.

    NOTE: This will not work if square is inside of a relatively positioned element!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason the background does not appear. This is the CSS div.sidebar_beige {
I have a search setup inside a div but for some reason cannot get
I tried positioning a div element using margin-bottom. For some reason the margin-bottom doesn't
I have an image and a hyperlink inside a div, but for some reason,
Hey guys i'm making a website but for some reason my div tags are
For some reason this isn't working? I want to fill the ul#list with some
For some reason, JavaScript/PHP wont delete my data from MySQL! Here is the rundown
I've got a jsFiddle working how I want: http://jsfiddle.net/6wuUc/64/ But for some reason, when
For some reason, Eclipse seems to think that e.g. <div> and <td> tags aren't
I want to achieve an effect similar to this: Position element fixed vertically, absolute

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.