We have a requirement where if checkbox is checked then we need to exchange position of tab 2 and 3

Is it possible to change the order of tabs in a tabset on basic on some checkbox. 
We have a requirement where if checkbox is checked then we need to exchange position of tab 2 and 3 with each other. 
JavaScript snippet for reorder tabs within tabset

Not ideal but a simple solution is to have several tab sets with the tabs in different orders then simply use render conditions to display whichever you need to show users based on their checkbox selections