Skip to content

Instantly share code, notes, and snippets.

@cloudxero
Created December 23, 2011 00:16
Show Gist options
  • Save cloudxero/1512449 to your computer and use it in GitHub Desktop.
Save cloudxero/1512449 to your computer and use it in GitHub Desktop.
DealerTrend API - Reorder VRS tabs
jQuery(document).ready(function() {
if (jQuery('body.home').length) {
// Only put as many variables as there are tabs
var first_tab;
var second_tab;
var third_tab;
var fourth_tab;
jQuery('.vrs-widget-item-wrapper').tabs('destroy');
jQuery('.vrs-widget-item-wrapper ul li').each(function(index) {
var tab = jQuery(this);
// Remove/Add any tab variables
if (tab.children().text().match(/chevrolet/i) != null) {
first_tab = tab;
} else if (tab.children().text().match(/cadillac/i) != null) {
second_tab = tab;
} else if (tab.children().text().match(/buick/i) != null) {
third_tab = tab;
} else if (tab.children().text().match(/gmc/i) != null) {
fourth_tab = tab;
}
});
jQuery('.vrs-widget-item-wrapper ul').html();
// Remove/Add any tab variables
jQuery('.vrs-widget-item-wrapper ul').append( first_tab );
jQuery('.vrs-widget-item-wrapper ul').append( second_tab );
jQuery('.vrs-widget-item-wrapper ul').append( third_tab );
jQuery('.vrs-widget-item-wrapper ul').append( fourth_tab );
jQuery('.vrs-widget-item-wrapper').tabs();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment