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

  • Home
  • SEARCH
  • 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 8672733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:16:39+00:00 2026-06-12T19:16:39+00:00

I have a div I’m trying to animate, I have it set up so

  • 0

I have a div I’m trying to animate, I have it set up so it animates by changing the marginTop property. The only problem is when I animate it to marginTop: O it’s not flush with the top of the containing div and I’m not sure why. It’s a lot so it’s easier to view it in a jsfiddle, http://jsfiddle.net/loriensleafs/F3wjg/21/ and the animation is prompted by clicking on the publications text at the top.

The div in question is profile_850_HEADER, when it animates it looks like it goes about 10px past the top of the containing div, the jquery is:

var staff_CONTAINER_850_ht = $('#staff_CONTAINER_850').height();

$("#launcher").click(function() {

$("#staff_CONTAINER_850").animate({
    marginTop: staff_CONTAINER_850_ht* -1
}, 300);


$("#profile_850_HEADER").animate({
    marginTop: 0
}, 300);
$("#profile_850_BIO").delay(120).animate({
    marginTop: 10
}, 450);
$("#profile_850_EDU").delay(220).animate({
    marginTop: 10
}, 450);
$("#profile_850_CONTACT").delay(320).animate({
    marginTop: 10
}, 450);


}); 


$(".close_850_profile").click(function() {
$("#staff_CONTAINER_850").animate({
    marginTop: "0px"
}, 300);
$("#profile_850_HEADER").animate({
    marginTop: 500
}, 200, function() {
    $("#profile_850_BIO").css("margin-top", "485px");
    $("#profile_850_EDU").css("margin-top", "485px");
    $("#profile_850_CONTACT").css("margin-top", "485px");
});
});

any help here would be great, I have no idea why this is happening.

  • 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-12T19:16:41+00:00Added an answer on June 12, 2026 at 7:16 pm

    It’s all a matter of what order things are in, the same reason you use document.ready() handlers. Try moving your height calculation (var staff_CONTAINER_850_ht = $('#staff_CONTAINER_850').height();) to after you’ve inserted all of your CSS:

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

    P.S. I reordered your code and put the CSS in a function so that it gets run first. I also put some “tips” in.

    P.S.S. I assume you don’t have access to any CSS files which is why you’re using JavaScript, but, if you do, you should probably use them.

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

Sidebar

Related Questions

I have div and buttons. .buttons size is not changing. (script.js is in the
I have div bar that is set to not scroll so it will always
I have DIV element which only has a few lines in and a background
I have next problem: There is jquery accordion control. One of tab have div
I have DIV with flexible width set e.g. min-width:800px and max-width:1400px. In this DIV,
I have 3 levels of div : (In green below) A top level div
I have div of fixed width containing only input text box and width of
I'm wondering is this is possible or not? Suppose i have div containing 10
I have div class=contentBlock which is treated as the container for updating <div class=contentBlock></div>
I have div ( #child ) which won't expand to the full height of

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.