Question

I'm using this code to make the accordion sortable, and to make the active accordion panel move to the top of the stack:

    $(function() {
    var stop = false;
    $("#ccaccordion h3").click(function( event ) {
        if ( stop ) {
            event.stopImmediatePropagation();
            event.preventDefault();
            stop = false;
        }
    });

    $("#ccaccordion").accordion({
            header: "> div > h3",
            autoHeight: false,
            change:
              function(event, ui){
                ui.newHeader.parent().prependTo(this);
              }
        }).sortable({
            axis: "y",
            handle: "h3",
            stop: function() {
                stop = true;
            }
        });

});

However it doesn't seem to be working. The standard demo code works fine with my html:

    $(function() {
        $( "#ccaccordion" ).accordion();
    });

Any ideas where I'm going wrong?

Thanks in advance!

Was it helpful?

Solution

Sorted,

I wasn't wrapping the h3 and subsequent div with another div. Knew it would be something simple. Thanks for your time Thomas! Yet again it was just me being an idiot...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top