Patrick сделал правильные замечания, и я не собираюсь повторять их. Однако мог бы я предлагать уменьшить 'если' операторы до читаемого английского языка по мере возможности при помощи хорошо названного булева Вара. Например, и это использует булевы операторы, но Вы могли одинаково использовать поразрядно и назвать bools соответственно:
bool onlyAIsTrue = (a && !b); // you could use bitwise XOR here
bool onlyBIsTrue = (b && !a); // and not need this second line
if (onlyAIsTrue || onlyBIsTrue)
{
.. stuff ..
}
Вы могли бы думать, что использование булевской переменной кажется ненужным, но оно помогает с двумя главным:
РЕДАКТИРОВАНИЕ: Вы явно не сказали желание условных выражений для того, 'если' операторы (хотя это кажется наиболее вероятным), который был моим предположением. Но мое предложение промежуточного булева значения все еще стоит.
Try something like this:
$tabs = $('#tabs').tabs({
cache: true
});
var total = $tabs.find('.ui-tabs-nav li').length;
var currentLoadingTab = 1;
$tabs.bind('tabsload',function(){
currentLoadingTab++;
if (currentLoadingTab < total)
$tabs.tabs('load',currentLoadingTab);
else
$tabs.unbind('tabsload');
}).tabs('load',currentLoadingTab);
It initializes the tabs with the cache option so that tabs aren't reloaded after they have been loaded once. It then finds out the total number of tabs and sets the next tab to load as 1 (tabs are indexed starting with 0 ) Then it binds an event on the load event to start loading the next tab until it has hit all of them. To start it of it then loads the second tab.