【发布时间】:2014-06-25 04:17:41
【问题描述】:
我有一架手风琴,我允许对它们进行分类。但是对于某些部分,我不想允许排序,而对于某些部分,我想允许排序。是否有任何内置选项可以实现这一目标。我将不胜感激任何帮助。以下是我的代码
$( "#accordion" ).accordion({
header: "> div > h3",
heightStyle: "content",
collapsible: true,
active: false,
activate: function( event, ui){
//this fixes any problems with sorting if panel was open (remove to see what I am talking about)
if(sorting)
$(this).sortable("refresh");
}
})
.sortable({
handle: "h3",
value: "ui-state-highlight",
start: function( event, ui ){
//change bool to true
sorting=true;
//find what tab is open, false if none
active = $(this).accordion( "option", "active" );
//possibly change animation here
$(this).accordion( "option", "animate", { easing: 'swing', duration: 0 } );
//close tab
$(this).accordion({ active:false });
unloadEditors();
},
stop: function( event, ui ) {
ui.item.children( "h3" ).triggerHandler( "focusout" );
//possibly change animation here; { } is default value
$(this).accordion( "option", "animate", { } );
//open previously active panel
console.log($(this).accordion);
$(this).accordion( "option", "active", "none" );
/*loadEditors();*/
//change bool to false
sorting=false;
},
update: function(event, ui) {
return;
var params = $(this).sortable('toArray');
var pageUrl = $("#orderUrl").val();
dataString = 'ordering='+params; $.ajax({
type: "POST",
url: pageUrl,
data: dataString,
success: function(data) {
}
});
}
});
【问题讨论】:
-
与我们分享您到目前为止的尝试。
-
@Aisha 请在此处发布您的代码或 jsfiddle??????
-
有一个类似的问题:stackoverflow.com/questions/4360904/…希望对你有帮助。
-
我已经把我的代码放在这里了。
-
您是否尝试过文档中提到的“项目”? api.jqueryui.com/sortable
标签: jquery