JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<a id="prev" href="#">prev</a>
<a id="next" href="#">next</a>
<div id="tt" class="easyui-tabs" style="width:600px;height:300px">
<div title="title1">t1</div>
<div title="title2">t2</div>
<div title="title3">t3</div>
<div title="title4">t4</div>
</div>
JavaScript
$.extend($.fn.tabs.methods, {
move: function(jq, param){
return jq.each(function(){
var state = $.data(this, 'tabs');
var tabs = state.tabs;
var index = -1;
for(var i=0; i<tabs.length; i++){
if (tabs[i][0] == param.tab[0]){
index = i;
break;
}
}
if (index >= 0){
var p = tabs[index];
tabs.splice(index, 1);
tabs.splice(param.index>index?param.index-1:param.index, 0, p);
var tab = p.panel('options').tab;
var to = tab.parent().children('li').eq(param.index);
if (to.length){
tab.insertBefore(to);
} else {
tab.appendTo(tab.parent());
}
}
})
}
});
function move(step){
var t = $('#tt');
var s = t.tabs('getSelected');
var index = t.tabs('getTabIndex',s) + step;
if (index >= 0){
t.tabs('move',{
tab:s,
index:index
});
}
}
$('#prev').click(function(){move(-1)});
$('#next').click(function(){move(2)});