Custom Animations

Menu 1

To programmatically change the animations after initial setup:
$("selector").accordion("option", "animate", "easingName");
$("selector").accordion("option", "animate", { easing: "easingName", duration: numberInMilliseconds });
$("selector").accordion("option", "animate", { easing: "easingName", duration: numberInMilliseconds, down: { easing: "easingName", duration: numberInMilliseconds } });

"down" is the animation used when opening a panel that comes before the currently active panel.

A list of easings can be found here.

Menu 2

The animation used when changing between panels can be changed. In this example, selecting a header after the current one causes it to bounce instead of smoothly transitioning. A different slide animation is used when selecting headers before the currently selected header.

Code

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/cupertino/jquery-ui.css" type="text/css"/>
    
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
        
        <script type="text/javascript">
            // $(function() { code }); executes the contained code when the DOM is finished loading
            $(function()
    	    {
    	        // Call the accordion method on the element with the id example
    	        $("#example").accordion(
                {
                    animate:
                    {
                        // Use the easeOutBounce animation for the panels. Time in milliseconds
                        easing: "easeInBounce", duration: 750,

                        // Use the easeInOutBack animation for panels with a lower index than the
                        // active panel. Time in milliseconds
                        down:
                        {
                                easing: "easeOutBack", duration: 500
                        }
                    }
                }); 
    	    });
        </script>
    </head>

    <body>
        <div id="example">
            <h3>Menu 1</h3>
            <p>This is some placeholder content in a p element.</p>
            <h3>Menu 2</h3>
            <p>This is more placeholder content in a second p element.
                It is coded directly below an h element which jQuery's
                accordion method turns into the header you see above this content.
            </p>
            <h3>Code</h3>
            <pre> *** This is what you are viewing *** </pre>
        </div>
    </body>
</html>