Skip to content

Instantly share code, notes, and snippets.

@twetzel
Created July 10, 2012 20:40
Show Gist options
  • Save twetzel/3086109 to your computer and use it in GitHub Desktop.
Save twetzel/3086109 to your computer and use it in GitHub Desktop.
jquery tabs with back & forward buttons
// Form-Tabs with 'previous' & 'next' buttons
var $the_tabs = $('#tabs').tabs();
$("#tabs .ui-tabs-panel").each(function(i){
var totalSize = $("#tabs .ui-tabs-panel").size() - 1;
log( totalSize );
if (i != totalSize) {
next = i + 2;
$(this).find('.editable-tab-box .headline')
.append("<a href='#' class='next-tab trigger right' rel='#" + $(this).next('.ui-tabs-panel').attr('id') + "'></a>");
}
if (i != 0) {
prev = i;
$(this).find('.editable-tab-box .headline')
.append("<a href='#' class='prev-tab trigger left' rel='#" + $(this).prev('.ui-tabs-panel').attr('id') + "'></a>");
}
});
// Tabs-Navigation
$('#tabs .next-tab, #tabs .prev-tab').live('click', function() {
$the_tabs.tabs('select', $(this).attr("rel"));
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment