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 565867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:55:02+00:00 2026-05-13T12:55:02+00:00

Please check out http://jsbin.com/omuqo for a demo of this issue. When you open a

  • 0

Please check out http://jsbin.com/omuqo for a demo of this issue.

When you open a panel by clicking on the handle, panels below slightly jitter throughout the animation.

In the demo, the below panels should remain completely still since all panels are of equal height. When you have a more complex accordion with panels of varying height, add easing, and so on, the jitter is still visible in various ways.

To debug, I’ve ditched the accordion plugin in Jquery UI and implemented my own, following the advice here.

Here’s the complete code should jsbin not work.

The HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
<title>Sandbox</title> 
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
<style type="text/css" media="screen"> 
* { margin: 0; padding: 0; } 
body { background-color: #fff; font: 16px Helvetica, Arial; color: #000; } 
dt { background-color: #ccc; } 
dd { height: 100px; } 
#footer { background-color: #ff9; } 
</style> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> 
</head> 
<body> 
  <dl> 
    <dt>Handle</dt> 
    <dd id="1">Content</dd> 
    <dt>Handle</dt> 
    <dd id="2">Content</dd> 
    <dt>Handle</dt> 
    <dd id="3">Content</dd> 
    <dt>Handle</dt> 
    <dd id="4">Content</dd> 
  </dl> 
  <div id="footer"> 
    Some more content 
  </div> 
</body> 
</html>

And the Javascript:

$.fn.accordion = function() {
  return this.each(function() {
    $container = $(this);

    // Hijack handles.
    $container.find("dt").each(function() {
      var $header = $(this);
      var $content = $header.next();

      $header
        .click(function() {  
          $container
            .find("dd:visible")
            .animate({ height: 0 }, { duration: 300, complete: function() {
                $(this).hide();
              }
            });
          if(!$content.is(":visible")) {
            $content
              .show()
            $content
              .animate({ height : heights[$content.attr("id")] }, { duration: 300 });
          }
          return false;
        });
    });

    // Iterate over panels, save heights, hide all.
    var heights = new Object();
    $container.find("dd").each(function() {

      $this = $(this);
      heights[$this.attr("id")] = $this.height();
      $this
        .hide()
        .css({ height : 0 });
    });
  });
};

$(document).ready(function() {
  $("dl").accordion();
});

To see a smooth accordion implementation, check out the homepage of Muxtape.

Any advice?

  • 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-05-13T12:55:02+00:00Added an answer on May 13, 2026 at 12:55 pm

    It seems I have a solution. Synchronize by pegging to an independent outside transition through the step callback. Here is a demo of the new method.

    This was a real headache!

    The javascript:

    $.fn.accordion = function() {
      return this.each(function() {
        $container = $(this);
    
        // Hijack handles.
        $container.find("dt").each(function() {
          var $header = $(this);
          var $selected = $header.next();
    
        $header
            .click(function() {  
              if ($selected.is(":visible")) {
                $selected
                  .animate({ height: 0 }, { duration: 300, complete: function() {
                    $(this).hide();
                  }
                });
              } else {
                $unselected = $container.find("dd:visible");
                $selected.show();
                var newHeight = heights[$selected.attr("id")];
                var oldHeight = heights[$unselected.attr("id")];
    
                $('<div>').animate({ height : 1 }, {
                  duration  : 300, 
                  step      : function(now) {
                    var stepSelectedHeight = Math.round(newHeight * now);
                    $selected.height(stepSelectedHeight);
                    $unselected.height(oldHeight + Math.round((newHeight - oldHeight) * now) - Math.round(newHeight * now));
                  },
                  complete  : function() {
                    $unselected
                      .hide()
                      .css({ height : 0 });
                    }
                });
              }
              return false;
            });
        });
    
        // Iterate over panels, save heights, hide all.
        var heights = new Object();
        $container.find("dd").each(function() {
    
          $this = $(this);
          $this.css("overflow", "hidden");
          heights[$this.attr("id")] = $this.height();
          $this
            .hide()
            .css({ height : 0 });
        });
      });
    };
    
    $(document).ready(function() {
      $("dl").accordion();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please check out this issue: http://code.google.com/p/android/issues/detail?id=20791 The project (https://github.com/kaciula/BugRetain) uses a CursorLoader to take
Please check out this page: http://onomadesign.com/wordpress/identity-design/hans-appenzeller/ The thumbnails on the right, link to different
Hi – Please check out this event pulled with the event.getInfo method: http://ws.audioscrobbler.com/2.0/?method=event.getinfo&event=2054422&api_key=b25b959554ed76058ac220b7b2e0a026 Notice
Could some on please check out this URL with Mozilla - http://smartplast.com/soon/ . As
Please check my website out: http://www.budgie.richardcmpage.com/index.php I've tried all sorts and can't get the
Please check out http://www.netcoremodeling.com in Chrome/Firefox/IE9, and then check it out in IE8, IE7.
check this out http://heroku.com/ How do you created stuff like this?(referring to the slidedown)
Please checkout this JS Bin http://jsbin.com/iqikuf/3/edit When the below is run in the console,
Please check out this jsfiddle http://jsfiddle.net/rr4GH/1/ As you can see its a round edge
http://smiths-heimann.az/index.php?feat=1 please check out this page. My php code looks like that. <?php /*at

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.