Friday, August 19, 2011

Working around with jQuery UI tabs select event


$('#tabs').tabs({
select: function(event, ui) {
var selected = ui.panel.id;
switch(selected){
case 'tab1':
//script will be executed when selected
break;

case tab2
//script will be executed when selected
break;

case tab3
//script will be executed when selected
break;

default:
//default script on load
break;
}
}
});

Thursday, August 18, 2011

Working around with jQuery UI accordion change event


This script is useful on change events using jQuery UI accordion.

$("#accordion").accordion({
        change: function(event, ui) {
            var active = $("#accordion").accordion('option','active');
switch(active){
case 0:
//this portion will be executed whenever you activate the first accordion
break;

case 1:
//this portion will be executed whenever you activate the second accordion
break;

case 2:
//this portion will be executed whenever you activate the third accordion
break;

default:
//you can also set a default script
break;
}
        }
    });