diff --git a/field_group/multipage/multipage.js b/field_group/multipage/multipage.js index 5e10691..d32b898 100644 --- a/field_group/multipage/multipage.js +++ b/field_group/multipage/multipage.js @@ -1,7 +1,7 @@ (function ($) { /** - * This script transforms a set of wrappers into a stack of multipage pages. + * This script transforms a set of wrappers into a stack of multipage pages. * Another pane can be entered by clicking next/previous. * */ @@ -24,22 +24,22 @@ Drupal.behaviors.MultiPage = { // Transform each div.multipage-pane into a multipage with controls. $panes.each(function () { - + $controls = $('
'); $(this).append('
').append($controls); - + // Check if the submit button needs to move to the latest pane. if (Drupal.settings.field_group.multipage_move_submit && $('.form-actions').length) { $('.form-actions', $form).remove().appendTo($($controls, $panes.last())); } - + var multipageControl = new Drupal.multipageControl({ title: $('> .multipage-pane-title', this).text(), wrapper: $(this), has_next: $(this).next().length, has_previous: $(this).prev().length }); - + $controls.append(multipageControl.item); $(this) .addClass('multipage-pane') @@ -48,9 +48,9 @@ Drupal.behaviors.MultiPage = { if (this.id == focusID) { paneWithFocus = $(this); } - + }); - + if (!paneWithFocus) { // If the current URL has a fragment and one of the tabs contains an // element that matches the URL fragment, activate that tab. @@ -84,12 +84,12 @@ Drupal.multipageControl = function (settings) { self.nextPage(); return false; }); - + this.previousLink.click(function () { self.previousPage(); return false; }); - + /* // Keyboard events added: // Pressing the Enter key will open the tab pane. @@ -115,7 +115,7 @@ Drupal.multipageControl = function (settings) { }; Drupal.multipageControl.prototype = { - + /** * Displays the tab's content pane. */ @@ -134,19 +134,21 @@ Drupal.multipageControl.prototype = { $('#active-multipage-control').remove(); this.nextLink.append('' + Drupal.t('(active page)') + ''); }, - + /** * Continues to the next page or step in the form. */ nextPage: function () { this.wrapper.next().data('multipageControl').focus(); + $('html, body').scrollTop($("#page").offset().top); }, - + /** * Returns to the previous page or step in the form. */ previousPage: function () { this.wrapper.prev().data('multipageControl').focus(); + $('html, body').scrollTop($("#page").offset().top); }, /**