关闭后jQuery UI Accordion不会重新打开

时间:2013-05-31 13:46:03

标签: jquery-ui jquery-ui-accordion jquery

我在jQuery UI Accordion中有一个表单。

使用此代码,访问者必须验证第一个面板,然后才会打开下一个手风琴面板。但是,如果访问者想要回到第一个面板,它就不会放手。

$(document).ready(function () {

    $("#accordion").accordion({ event: false });

    $('#openfirst').click(function () {

        if (varification is okay then) {

            $("#accordion").accordion({ active: 1 });

                // cancel submit
                return false;

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

        $('#opensecond').click(function () {


            if (varification is okay then) {

                $("#accordion").accordion({ active: 2 });

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

        $('#openthird').click(function () {

            if (varification is okay then) {

                $("#accordion").accordion({ active: 3 });

                // cancel submit
                return false;

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

    });
</script>

1 个答案:

答案 0 :(得分:0)

而不是使用

$("#accordion").accordion({ event: false });

尝试使用

$( ".selector" ).accordion( "disable" );

并在用户验证后使用

$( ".selector" ).accordion( "enable" ); //for manual operation of tabs

$( ".selector" ).accordion({ active: # }); //for code generated operation of tabs