我希望有类似于 JQuery UI 中的可排序手风琴的东西,它会自动排序,即活动的手风琴面板(打开的手风琴面板 - 最后一个点击)自动移动到手风琴的顶部。
有任何想法吗?
这是 JQ UI 页面的链接:http: //jqueryui.com/demos/accordion/#sortable
谢谢!
这是我的代码(回复托马斯):
$(function() {
var stop = false;
$("#ccaccordion h3").click(function( event ) {
if ( stop ) {
event.stopImmediatePropagation();
event.preventDefault();
stop = false;
}
});
$("#ccaccordion")
.accordion({
header: "> div > h3",
autoHeight: false,
"option",
"change",
function(event, ui){
ui.newHeader.parent().prependTo(this);
}
})
.sortable({
axis: "y",
handle: "h3",
stop: function() {
stop = true;
}
});
});