Basic jQuery slideUp and slideDown driving me mad!

后端 未结 10 775
情深已故
情深已故 2020-12-09 19:06

my jQuery skills are pretty good normally but this is driving me mad!

It\'s a fairly simple accordian I\'ve coded up from scratch. Using jQuery 1.3.2 so there should

10条回答
  •  醉梦人生
    2020-12-09 19:53

    Get the height once the div has finished its animation from the callback. It's possible that you're getting the height while the div is being animated, and you're getting a transitional value.

    If your animation is jumpy, try using the callbacks. Don't open a div and hide a div at the same time. Instead, hide your first div, and within the callback show your next div.

    $(".someDiv").slideUp("normal", function(){
      /* This animation won't start until the first
         has finished */
      $(".someOtherDiv").slideDown();
    });
    

    Updated (From the comments):

    redsquare: http://jqueryfordesigners.com/slidedown-animation-jump-revisited/

提交回复
热议问题