};
});
- // Select a tab
- this.selected = this.tabs[ panels.first().data('customizeTab') ];
- this.selected.both.addClass('library-selected');
-
// Bind tab switch events
this.library.children('ul').on( 'click', 'li', function( event ) {
var id = $(this).data('customizeTab'),
this.tabs.uploaded.both.addClass('hidden');
}
+ // Select a tab
+ panels.each( function() {
+ var tab = control.tabs[ $(this).data('customizeTab') ];
+
+ // Select the first visible tab.
+ if ( ! tab.link.hasClass('hidden') ) {
+ control.selected = tab;
+ tab.both.addClass('library-selected');
+ return false;
+ }
+ });
+
this.dropdownInit();
},
success: function( attachment ) {