mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
0627eb3645
commit
f1fa076f62
@ -9,10 +9,21 @@
|
||||
<script src="../../external/requirejs/require.js"></script>
|
||||
<script src="../bootstrap.js" data-modules="sortable">
|
||||
var tabs = $( "#tabs" ).tabs();
|
||||
var previouslyFocused = false;
|
||||
|
||||
tabs.find( ".ui-tabs-nav" ).sortable({
|
||||
axis: "x",
|
||||
stop: function() {
|
||||
|
||||
// Sortable removes focus, so we need to restore it if the tab was focused
|
||||
// prior to sorting
|
||||
start: function(event, ui) {
|
||||
previouslyFocused = document.activeElement === ui.item[ 0 ];
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
tabs.tabs( "refresh" );
|
||||
if (previouslyFocused) {
|
||||
ui.item.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user